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')
Estoy tratando de leer un shapefile en networkx y ejecutar steiner_tree
aproximación sobre ella. Me dice que mi grafo es dirigido. Cuando lo hago no dirigido, me da el error:
networkx.exception.NetworkXError: G is not a connected graph. metric_closure is not defined.