1212
1313@pytest .fixture (name = "graphs" )
1414def fixture_graphs ():
15- return dynnode2vec .utils .generate_dynamic_graphs (
15+ return dynnode2vec .utils .create_dynamic_graph (
1616 n_base_nodes = 30 , n_steps = 5 , base_density = 0.02
1717 )
1818
1919
20+ def add_random_weights (graph ):
21+ for * _ , data in graph .edges (data = True ):
22+ data ["weight" ] = random .random ()
23+
24+
2025def test_init (graphs ):
2126 brw = dynnode2vec .biased_random_walk .BiasedRandomWalk (graphs [0 ])
2227
@@ -46,12 +51,11 @@ def test_generate_walk(graphs, ip, iq, weighted):
4651 # pylint: disable=invalid-name
4752 # make sure that tested node has at least one neighbor
4853 graph = graphs [0 ]
49- graph .add_edge (0 , 1 , weight = 0.5 )
54+ graph .add_edge ("0" , "1" )
5055
5156 # add random weights to the graph for the weighted case
5257 if weighted :
53- for _ , _ , data in graph .edges (data = True ):
54- data ["weight" ] = random .random ()
58+ add_random_weights (graph )
5559
5660 brw = dynnode2vec .biased_random_walk .BiasedRandomWalk (graph )
5761 rng = random .Random (0 )
@@ -74,8 +78,7 @@ def test_run(graphs, p, q, weighted):
7478
7579 # add random weights to the graph for the weighted case
7680 if weighted :
77- for * _ , data in graph .edges (data = True ):
78- data ["weight" ] = random .random ()
81+ add_random_weights (graph )
7982
8083 brw = dynnode2vec .biased_random_walk .BiasedRandomWalk (graph )
8184
0 commit comments