I have to find the number of cycles in a graph.
I have a set of nodes connected to each other which have the following structure:
class Node:
   def __init__(self, id, value):
     self.divergencePoint = 0
     self.convergencePoint = 0
     self.id = id
     self.value = value
     self.parents = []
     self.children = []
I have successfully created the graph and the fields divergencePoint and convergencePoint are set to 1 if it is a convergence point or a divergence point.
Now how can I detect the cycles ?
 
    