forked from Shoobx/python-graph
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_data.py
More file actions
80 lines (71 loc) · 2.02 KB
/
test_data.py
File metadata and controls
80 lines (71 loc) · 2.02 KB
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
73
74
75
76
77
78
79
80
"""
Misc functions used for testing, including the generation of test-data.
"""
EDGES = [
("China", "Russia"),
("Afghanistan", "Iran"),
("China", "Russia"),
("China", "Mongolia"),
("Mongolia", "Russia"),
("Mongolia", "China"),
("Nepal", "China"),
("India", "Pakistan"),
("India", "Nepal"),
("Afghanistan", "Pakistan"),
("North Korea", "China"),
("Romania", "Bulgaria"),
("Romania", "Moldova"),
("Romania", "Ukraine"),
("Romania", "Hungary"),
("North Korea", "South Korea"),
("Portugal", "Spain"),
("Spain","France"),
("France","Belgium"),
("France","Germany"),
("France","Italy",),
("Belgium","Netherlands"),
("Germany","Belgium"),
("Germany","Netherlands"),
("Germany","Denmark"),
("Germany","Luxembourg"),
("Germany","Czech Republic"),
("Belgium","Luxembourg"),
("France","Luxembourg"),
("England","Wales"),
("England","Scotland"),
("England","France"),
("Scotland","Wales"),
("Scotland","Ireland"),
("England","Ireland"),
("Switzerland","Austria"),
("Switzerland","Germany"),
("Switzerland","France"),
("Switzerland","Italy"),
("Austria","Germany"),
("Austria","Italy"),
("Austria","Czech Republic"),
("Austria","Slovakia"),
("Austria","Hungary"),
("Austria","Slovenia"),
("Denmark","Germany"),
("Poland","Czech Republic"),
("Poland","Slovakia"),
("Poland","Germany"),
("Poland","Russia"),
("Poland","Ukraine"),
("Poland","Belarus"),
("Poland","Lithuania"),
("Czech Republic","Slovakia"),
("Czech Republic","Germany"),
("Slovakia","Hungary")]
def nations_of_the_world( G ):
"""
This is intended to simplify the unit-tests. Given a graph add the nations of the world to it.
"""
for a,b in EDGES:
for n in [a,b,]:
if not n in G.nodes():
G.add_node(n)
if (not G.has_edge(a,b)):
G.add_edge( a,b )
return G