let P be the set of paths from room 1 to the exit (room 0) let E be the bag of edges in P let freq(e) := the number of times e is found in E edgecounter = 0 edgesremoved = {} forall p in P: if p is not broken remove e in P such that freq(e) > freq(f) forall f in P // remove the most frequent edge edgesremoved += {e} edgecounter++ // p is now broken