Index
Help
1
2
3
4
5
6
7
8
9
10
11
12
13
s = PickVertex()
dist[s] = 0
pred[s] = None
count = 0
NEXT.Append(s)
while
count < G.Order()
and
NEXT.IsNotEmpty():
if
NOW.IsEmpty():
while
NEXT.IsNotEmpty():
v = NEXT.Top()
NOW.Append(v)
count += 1
while
NOW.IsNotEmpty():
v = NOW.Top()
for
w
in
Neighborhood(v):
if
dist[w] > dist[v] + length[(v,w)]:
pred[w] = v
dist[w] = dist[v] + length[(v,w)]
if
not
NEXT.Contains(w):
NEXT.Append(w)
if
NEXT.IsNotEmpty():
t = NEXT.Top()
marked[t] = 1
while
not
marked.QDefined(pred[t]):
t = pred[t]
marked[t] = 1
root = t
while
pred[t] != root:
circuit.AddEdge((pred[t],t))
t = pred[t]
circuit.AddEdge((pred[t],t))