-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathtinyEWG.txt
42 lines (38 loc) · 1008 Bytes
/
tinyEWG.txt
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
G = EdgeWeightedGraph(8)
G.addEdge(Edge(4, 5, 0.35))
G.addEdge(Edge(4, 7, 0.37))
G.addEdge(Edge(5, 7, 0.28))
G.addEdge(Edge(0, 7, 0.16))
G.addEdge(Edge(1, 5, 0.32))
G.addEdge(Edge(0, 4, 0.38))
G.addEdge(Edge(2, 3, 0.17))
G.addEdge(Edge(1, 7, 0.19))
G.addEdge(Edge(0, 2, 0.26))
G.addEdge(Edge(1, 2, 0.36))
G.addEdge(Edge(1, 3, 0.29))
G.addEdge(Edge(2, 7, 0.34))
G.addEdge(Edge(6, 2, 0.40))
G.addEdge(Edge(3, 6, 0.52))
G.addEdge(Edge(6, 0, 0.58))
G.addEdge(Edge(6, 4, 0.93))
for e in G.edges():
minpq.insert(e)
for _ in range(G.E()):
print minpq.delMin()
DG = EdgeWeightedDigraph(8)
DG.addEdge(Edge(0, 1, 5))
DG.addEdge(Edge(0, 4, 9))
DG.addEdge(Edge(0, 7, 8))
DG.addEdge(Edge(1, 2, 12))
DG.addEdge(Edge(1, 3, 15))
DG.addEdge(Edge(1, 7, 4))
DG.addEdge(Edge(2, 3, 3))
DG.addEdge(Edge(2, 6, 11))
DG.addEdge(Edge(3, 6, 9))
DG.addEdge(Edge(4, 5, 4))
DG.addEdge(Edge(4, 6, 20))
DG.addEdge(Edge(4, 7, 5))
DG.addEdge(Edge(5, 2, 1))
DG.addEdge(Edge(5, 6, 13))
DG.addEdge(Edge(7, 5, 6))
DG.addEdge(Edge(7, 2, 7))