docs: def floyd_warshall_get_cycle(self, distance, nextn, element = None):
          '''
          API:
              floyd_warshall_get_cycle(self, distance, nextn, element = None)
          Description:
              Finds a negative cycle in the graph.
          Pre:
              (1) distance and nextn are outputs of floyd_warshall method.
              (2) The graph should have a negative cycle, , ie.
              distance[(i,i)] < 0 for some node i.
          Return:
              Returns the list of nodes on the cycle. Ex: [i,j,k,...,r], where
              (i,j), (j,k) and (r,i) are some edges in the cycle.
          '''
          nl = self.get_node_list()
          if element is None:
              for i in nl:
                  if distance[(i,i)] < 0:
                      # graph has a cycle on the path from i to i.
                      element = i
                      break
              else:
                  raise Exception('Graph does not have a negative cycle!')
          elif distance[(element,element)] >= 0:
              raise Exception('Graph does not have a negative cycle that contains node '+str(element)+'!')
          # find the cycle on the path from i to i.
          cycle = [element]
          k = nextn[(element,element)]
          while k not in cycle:
              cycle.insert(1,k)
              k = nextn[(element,k)]
          if k==element:
              return cycle
          else:
              return self.floyd_warshall_get_cycle(distance, nextn, k)