-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun_dynamic.py
72 lines (49 loc) · 1.52 KB
/
run_dynamic.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
from RandomWalk import RandomWalk
from NodeVision import NodeVision
import FakeNetwork as fk
from networkx import nx
nodecount = 300
fg = fk.FakeGraph(nodecount)
gr = nx.DiGraph()
gr.add_node(0)
Gw = NodeVision(gr=gr)
for i in range(1, nodecount, 30):
Gw.graph.add_edge(0, i, weight=1.0)
for i in range(12, nodecount, 100):
Gw.graph.add_edge(i, 0, weight=1.0)
# Initialization
trs = fg.generate_transactions(500)
Gw.add_transactions(trs)
trs = fg.generate_local_transactions(Gw.rootnode, 5)
Gw.add_transactions(trs)
Gw.normalize_edge_weights()
Gw.reposition_nodes()
Gw.show_undirected_bfs_tree()
Gw.update_component()
Gw.show_directed_neighborhood()
rw = RandomWalk(Gw, fake=True)
rw.set_walk_params({'n_walk': 10, 'reset_prob': 0.1, 'n_step': 300})
rw.set_move_params({'time_to_finish': 10})
rw.show_walk()
# def step(rw):
# # Gw.diminish_weights()
# trs = fg.generate_transactions(500)
# Gw.add_transactions(trs)
# trs = fg.generate_local_transactions(Gw.rootnode, 5, 0.8, True)
# Gw.add_transactions(trs)
# Gw.normalize_edge_weights()
# Gw.reposition_nodes()
# Gw.update_component()
# rw.update_local_vision(Gw, animate=True)
# rw.show_walk()
# rw.remove_old_nodes(0.9)
# for i in range(1):
# step(rw)
# Gw = NodeVision(n_nodes=400)
# Gw.show_undirected_bfs_tree()
# Gw.show_directed_neighborhood()
# Gw.show_undirected_bfs_tree()
# Gw.show_directed_neighborhood()
# rw = RandomWalk(Gw)
# rw.set_walk_params({'n_walk': 100, 'reset_prob': 0.1, 'n_step': 300})
# rw.show_walk()