--- a/pyforge/flyway/graph.py
+++ b/pyforge/flyway/graph.py
@@ -5,6 +5,9 @@
def __init__(self, migrations):
self._build_graph(migrations)
+
+ def reset(self):
+ for n in self._nodes: n.reset()
def _build_graph(self, migrations):
'''Build a graph where the nodes are possible migration states and the
@@ -121,10 +124,13 @@
def __init__(self, state):
self.state = state
+ self.succs = [] # list of (state, migrationstep)
+ self.reset()
+
+ def reset(self):
self.visited = False
+ self.pred = None # (state, migrationstep)
self.distance = 1e9 # effectively inf
- self.pred = None # (state, migrationstep)
- self.succs = [] # list of (state, migrationstep)
def visit(self, nodes):
'''The 'visit' step of Dijkstra's shortest-path algorithm'''