yet another performance improvement
This commit is contained in:
@@ -131,10 +131,17 @@ def build_network(n):
|
||||
#if lvl(i) == lvl(i - l_lvl) and l_lvl:
|
||||
join_nodes(g, nn(i, 'lu'), nn(neigh(i, -l_lvl * 2), 'ld'))
|
||||
|
||||
join_nodes(g, nn(i, 'rs'), nn(neigh(i, +l_lvl * 3), 'ls'))
|
||||
join_nodes(g, nn(i, 'ls'), nn(neigh(i, -l_lvl * 5), 'rs'))
|
||||
|
||||
# irregular: inline ring
|
||||
join_nodes(g, nn(i, 'rs'), nn(neigh(i, +1), 'ls'), 5)
|
||||
join_nodes(g, nn(i, 'ls'), nn(neigh(i, -1), 'rs'), 5)
|
||||
|
||||
#if l_lvl >= 4:
|
||||
#join_nodes(g, nn(i, 'rs'), nn(neigh(i, +12), 'ls'), 6)
|
||||
#join_nodes(g, nn(i, 'ls'), nn(neigh(i, -12), 'rs'), 6)
|
||||
|
||||
return g
|
||||
|
||||
def analyze(G: nx.Graph) -> dict:
|
||||
@@ -269,7 +276,7 @@ def test2():
|
||||
print(set([v for i, v in g.degree()]))
|
||||
|
||||
def test3():
|
||||
g = build_network(7)
|
||||
g = build_network(3)
|
||||
visualize(g)
|
||||
|
||||
if __name__=="__main__":
|
||||
|
||||
Reference in New Issue
Block a user