added build_edges method.