-
Notifications
You must be signed in to change notification settings - Fork 0
/
Nodes.py
51 lines (42 loc) · 892 Bytes
/
Nodes.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
class Node:
def __init__(self, airport, time):
self.j = airport
self.t = time
self.outgoing = []
self.incoming = []
class StartNode(Node):
count = 0
def __init__(self, i,t):
self.j = i
self.t = t
self.outgoing = []
self.incoming = []
StartNode.count += 1
def __str__(self):
return self.j + str(self.t)
def __gt__(self,other):
return self.t > other.t
class EndNode(Node):
count = 0
def __init__(self,j,t):
self.j = j
self.t = t
self.outgoing = []
self.incoming = []
EndNode.count += 1
def __str__(self):
return self.j + str(self.t)
def __gt__(self,other):
return self.t > other.t
class SinkNode(Node):
count = 0
def __init__(self,airport):
self.j = airport
self.t = -1
self.outgoing = []
self.incoming = []
SinkNode.count += 1
def __gt__(self,other):
return self.t > other.t
def __str__(self):
return "Sink "+self.j