Compare commits

...

2 Commits

Author SHA1 Message Date
32dd37feea WIP: test relationship with boundary 2026-03-04 15:35:15 +01:00
b2edb8265b add: degree centrality 2026-03-04 15:34:51 +01:00

View File

@@ -8,6 +8,16 @@ from src import centrality
from src import plot
from src import fitting
def degree(g, weight):
# VertexPropertyMap
vp = g.new_vertex_property("double")
for v in g.vertices():
neighbours = g.get_all_neighbours(v)
vp[v] = len(neighbours)
return vp
def leverage(g, weight):
# VertexPropertyMap
vp = g.new_vertex_property("double")
@@ -144,18 +154,15 @@ fig_graph.savefig("Pointcloud_graph.svg", format='svg')
fig = plt.figure(figsize=(15, 10))
axs = fig.subplots(2, 4)
i = 0
for ax in axs:
# TODO select corresponding centrality measure method
apply(g, seed, weight, convex_hull, ax, closeness, "Closeness")
apply(g, seed, weight, convex_hull, ax, pagerank, "PageRank")
apply(g, seed, weight, convex_hull, ax, betweeness, "Betweeness")
apply(g, seed, weight, convex_hull, ax, eigenvector, "Eigenvector")
apply(g, seed, weight, convex_hull, ax, katz, "Katz")
# TODO to implement
# - Laplacian
# - Leverage
# - Degree (seriously?)
i += 1
apply(g, seed, weight, convex_hull, ax, katz, "Katz")
apply(g, seed, weight, convex_hull, ax, hits, "Hits")
apply(g, seed, weight, convex_hull, ax, leverage, "Leverage")
apply(g, seed, weight, convex_hull, ax, degree, "Degree")
fig.savefig(f"Comparison_Pointcloud.svg", format='svg')