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
+4 -4
View File
@@ -38,7 +38,7 @@ def spatial_graph(adata):
def apply(g, seed, weight, convex_hull, ax, ax2, method):
# calculate centrality values
vp = method(g, weight=weight)
vp, ep = method(g, weight=weight)
vp.a = np.nan_to_num(vp.a) # correct floating point values
min_val, max_val = vp.a.min(), vp.a.max()
vp.a = (vp.a - min_val) / (max_val - min_val)
@@ -63,13 +63,13 @@ fig = plt.figure(figsize=(21, 5))
ax1, ax2, ax3 = fig.subplots(1, 3)
# plot graph with convex_hull
vp = closeness(g, weight=weight)
vp, ep = betweenness(g, weight=weight)
vp.a = np.nan_to_num(vp.a) # correct floating point values
min_val, max_val = vp.a.min(), vp.a.max()
vp.a = (vp.a - min_val) / (max_val - min_val)
plot.graph_plot(fig, ax1, g, vp, convex_hull, f"Pointcloud (seed: {seed})", False)
apply(g, seed, weight, convex_hull, ax2, ax3, closeness)
apply(g, seed, weight, convex_hull, ax2, ax3, betweenness)
fig.savefig(f"Distance_5000_node_closeness.svg", format='svg')
fig.savefig(f"Distance_5000_node_betweenness.svg", format='svg')