Push–relabel maximum flow algorithm: Difference between revisions

Content deleted Content added
Addbot (talk | contribs)
m Bot: Migrating 4 interwiki links, now provided by Wikidata on d:q583889 (Report Errors)
Sample implementation: do not use var name "list" in python, it is a standard function
Line 215:
seen = [0] * n # neighbours seen since last relabel
# node "queue"
list nodelist = [i for i in xrange(n) if i != source and i != sink]
 
def push(u, v):
Line 251:
 
p = 0
while p < len(listnodelist):
u = listnodelist[p]
old_height = height[u]
discharge(u)
if height[u] > old_height:
listnodelist.insert(0, listnodelist.pop(p)) # move to front of list
p = 0 # start from front of list
else: