title: Finding reachable vertices of a vertice in a graph
body: <p>I am having problem in my code to calculate the reachable vertices in a graph.</p>
  
  <p>I have the following code for the graph</p>
  
  <pre><code>class Vertices():
      number = 0
      def __init__(self):
          Vertices.number += 1
          self.number = Vertices.number
          self.Reachable= []
  </code></pre>
  
  <p>I create the graph in the following way </p>
  
  <pre><code>a = Vertices()
  a.Reachable = [1,2]
  b = Vertices()
  b.Reachable = [3]
  c = Vertices()
  c.Reachable= [3]
  List = []
  List.append(a)
  List.append(b)
  List.append(c)
  </code></pre>
  
  <p>Thus vertice 1 that is a has an edge to itself and b . Similarly for b and for c.</p>
  
  <p>We can move around the graph using List ie for vertex a it is reachable to List[trans-1] where trans refers to the <code>Reachable list of a (List[0] and List[1])</code></p>
  
  <p>Now in this graph I have to calculate the reachability for each vertice ie for each vertice calculate the vertices that it can reach.For eg a can reach a,b and c</p>
  
  <p>I have read that I can use sets to do depth first search in all the list. Can you provide me a solution as to how to proceed.</p>
  
  <p>Can anyone tell me how to use sets as I think that it is quite ideal for this problem seeing that it has union and difference functions associated with it....
  PS : This is'nt a school based assignment.....</p>