def time_mean_node_dist(self): mm.mean_node_dist(self.network)
def test_mean_node_dist(self): net = mm.mean_node_dist(self.network) check = 148.8166441307652 assert net.nodes[(1603650.450422848, 6464368.600601688)]["meanlen"] == check
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) edges["ldsMSL"] = mm.SegmentsLength(edges, spatial_weights=edges_w3, mean=True).series