Пример #1
0
 def test_cds_length(self):
     net = mm.cds_length(self.network)
     net2 = mm.cds_length(self.network, mode='mean', name='cds_mean')
     sumval = 1753.626758955522
     mean = 219.20334486944023
     assert net.nodes[(1603650.450422848, 6464368.600601688)]['cds_len'] == sumval
     assert net2.nodes[(1603650.450422848, 6464368.600601688)]['cds_mean'] == mean
Пример #2
0
 def test_cds_length(self):
     net = mm.cds_length(self.network)
     net2 = mm.cds_length(self.network, mode="mean", name="cds_mean")
     sumval = 1753.626758955522
     mean = 219.20334486944023
     assert net.nodes[(1603650.450422848, 6464368.600601688)]["cds_len"] == sumval
     assert net2.nodes[(1603650.450422848, 6464368.600601688)]["cds_mean"] == mean
     with pytest.raises(ValueError):
         net2 = mm.cds_length(self.network, mode="nonexistent")
     assert mm.cds_length(self.network, radius=None) == 2291.4520621447705
Пример #3
0
 def time_cds_length(self):
     mm.cds_length(self.network)
    degree="degree",
    length="mm_len",
    mean_node_degree=False,
    proportion={
        0: True,
        3: True,
        4: True
    },
    cyclomatic=False,
    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)