code: def getNextNode(nodes,usednodes,parent):
      '''Get next node in a breadth-first traversal of nodes that have not been used yet'''
      for e in edges:
          if e.source==parent:
              if e.target in usednodes:
                  x = e.target
                  break
          elif e.target==parent:
              if e.source in usednoes:
                  x = e.source
                  break  
      return f getNextNode(nodes,usednodes,parent):
      '''Get next node in a breadth-first traversal of nodes that have not been used yet'''
      for e in edges:
          if e.source==parent:
              if e.target in usednodes:
                  x = e.target
                  break
          elif e.target==parent:
              if e.source in usednoes:
                  x = e.source
                  break  
      return x
docs: Get next node in a breadth-first traversal of nodes that have not been used yet