bugfix in path_connects() and build_graph()