WIP
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user