Create adjacency list
if u not in m : NEW_LINE INDENT m [ u ] = [ ] NEW_LINE DEDENT if v not in m : NEW_LINE INDENT m [ v ] = [ ] NEW_LINE DEDENT m [ u ] . append ( v ) NEW_LINE m [ v ] . append ( u ) ; NEW_LINE