import networkx as nx from networkx.algorithms import approximation as ax Road = nx.read_shp('/Users/benjaminhendel/Downloads/scatteredroads.shp') #Reading Road Data Base = nx.read_shp('/Users/benjaminhendel/Downloads/testptssnapped.shp') #Reading Terminal Node nodes = list(Base.nodes) #Creating list of terminal nodes Road = Road.to_undirected() st_tree = ax.steinertree.steiner_tree(Road,nodes,weight='length')
I'm trying to read a shapefile into networkx and run
steiner_tree approximation on it. It tells me that my graph is directed. When I make it undirected, it gives me the error:
networkx.exception.NetworkXError: G is not a connected graph. metric_closure is not defined.