4
0
mirror of https://github.com/cwinfo/yggdrasil-map synced 2025-08-14 17:08:09 +00:00

changes to get it working with y.yakamo.org:3000/current as a source of node info

This commit is contained in:
Arceliar
2018-11-16 21:55:30 -06:00
parent ee631b927e
commit 3d6523fab3
2 changed files with 55 additions and 7 deletions

View File

@@ -8,10 +8,10 @@ def position_nodes(nodes, edges):
G = pgv.AGraph(strict=True, directed=False, size='10!')
for n in nodes.values():
G.add_node(n.ip, label=n.label, version=n.version)
G.add_node(n.coords, label=n.ip, version=n.version)
for e in edges:
G.add_edge(e.a.ip, e.b.ip, len=1.0)
G.add_edge(e.a.coords, e.b.coords, len=1.0)
G.layout(prog='neato', args='-Gepsilon=0.0001 -Gmaxiter=100000')
@@ -53,7 +53,7 @@ def get_graph_json(G):
}
centralities = compute_betweenness(G)
db = load_db()
#db = load_db()
for n in G.iternodes():
neighbor_ratio = len(G.neighbors(n)) / float(max_neighbors)
@@ -61,7 +61,7 @@ def get_graph_json(G):
centrality = centralities.get(n.name, 0)
pcentrality = (centrality + 0.0001) * 500
size = (pcentrality ** 0.3 / 500) * 1000 + 1
name = db.get(n.name)
name = None#db.get(n.name)
out_data['nodes'].append({
'id': n.name,