<s> from collections import deque <EOL> def bfs ( graph , start = <NUM_LIT:0> ) : <EOL> """<STR_LIT>""" <EOL> to_visit = deque ( ) <EOL> dist = [ float ( '<STR_LIT>' ) ] * len ( graph ) <EOL> prec = [ None ] * len ( graph ) <EOL> dist [ start ] = <NUM_LIT:0> <EOL> to_visit . appendleft ( start ) <EOL> while to_visit : <EOL> node = to_visit . pop ( ) <EOL> for neighbor in graph [ node ] : <EOL> if dist [ neighbor ] == float ( '<STR_LIT>' ) : <EOL> dist [ neighbor ] = dist [ node ] + <NUM_LIT:1> <EOL> prec [ neighbor ] = node <EOL> to_visit . appendleft ( neighbor ) <EOL> return dist , prec </s>
