This commit is contained in:
2026-04-16 07:20:19 +02:00
parent a6bef6e9a1
commit 3acf54a000
5 changed files with 161 additions and 44 deletions
+20
View File
@@ -55,6 +55,26 @@ def leverage(g, weight):
return vp
def path(g, weight):
# NOTE is this not just betweenness?
ep = g.new_vertex_property("double")
for v in g.vertices():
for u in g.vertices():
if (v == u):
continue
paths = graph_tool.topology.all_shortest_paths(g, v, u, weights=weight, edges=True)
for edges in paths:
for edge in edges:
for idx, g_e in enumerate(g.edges()):
if (g_e == edge):
# NOTE we end up counting twice!
ep[idx] += 0.5;
break
# for e in g.edges():
# ep[e] /= 2;
return ep
def random_graph(n=5000, seed=None):
"""
Uniformly random point cloud generation.