ShapeX的NetworkX读取返回子图的空列表

时间:2016-12-20 17:29:20

标签: graph networkx shapefile

我在旧金山市有两个公路文件,一个通过US Census获得,另一个通过SFData获得。

我想使用第二个,似乎更充实。

但是当我试图找到它的连接子图时,我得到一个空列表。对于人口普查版本,我得到一个健康的对象列表,如<networkx.classes.graph.Graph at 0x11ef99cdb00>

我(天真地)假设SFData是一个完全连接的图形,但我读过的所有文档都表明我仍然会返回单个元素列表。

我错过了什么?如何将SF数据转换为可用的图形?

import networkx as nx

#sfdata
g = nx.read_shp('Road files/geo_export_93b884b0-683e-4cbe-bde2-78574254c7f2.shp')
sg = list(nx.connected_component_subgraphs(g.to_undirected()))

#census
g2 = nx.read_shp('Road files/tl_2016_06075_roads.shp')
sg2 = list(nx.connected_component_subgraphs(g2.to_undirected()))

0 个答案:

没有答案
相关问题