コード例 #1
0
ファイル: bench_graph.py プロジェクト: yzuaiyou/momepy
 def time_clustering(self):
     mm.clustering(self.network)
コード例 #2
0
 def test_clustering(self):
     net = mm.clustering(self.network)
     check = 0.05555555555555555
     assert net.nodes[(1603650.450422848,
                       6464368.600601688)]["cluster"] == check
コード例 #3
0
    edge_node_ratio=False,
    gamma=False,
    local_closeness=True,
    closeness_distance="mm_len",
)
print("cds length")
graph = mm.cds_length(graph, radius=3, name="ldsCDL")

print("eigenvector")
try:
    graph = mm.eigenvector(graph, name="xcnEiC", max_iter=500)
except Exception:
    graph = mm.eigenvector(graph, name="xcnEiC", max_iter=1000)

print("clustering")
graph = mm.clustering(graph, name="xcnSCl")

print("mean_node_dist")
graph = mm.mean_node_dist(graph, name="mtdMDi")

nodes, edges, sw = mm.nx_to_gdf(graph, spatial_weights=True)

print("saving")
nodes.to_file("files/elements.gpkg", layer="nodes", driver="GPKG")
edges.to_file("files/elements.gpkg", layer="edges", driver="GPKG")

fo = libpysal.io.open("files/GRnodes.gal", "w")
fo.write(sw)
fo.close()

edges_w3 = mm.sw_high(k=3, gdf=edges)