public void Create(IMutableVertexAndEdgeListGraph tc)
 {
     if (tc == null)
     {
         throw new ArgumentNullException("tc");
     }
     CondensationGraphAlgorithm algorithm = new CondensationGraphAlgorithm(this.VisitedGraph);
     algorithm.Create(this.cg);
     ArrayList vertices = new ArrayList(this.cg.get_VerticesCount());
     new TopologicalSortAlgorithm(this.cg, vertices).Compute();
     VertexIntDictionary dictionary = new VertexIntDictionary();
     VertexIntDictionary dictionary2 = new VertexIntDictionary();
     for (int i = 0; i < vertices.Count; i++)
     {
         IVertex vertex = (IVertex) vertices[i];
         dictionary2.Add(vertex, i);
         if (!dictionary.Contains(vertex))
         {
             dictionary.Add(vertex, 0);
         }
     }
     VertexListMatrix chains = new VertexListMatrix();
     int num2 = -1;
     Label_0112:
     foreach (IVertex vertex2 in vertices)
     {
         if (dictionary.get_Item(vertex2) == 0)
         {
             num2 = chains.AddRow();
             IVertex vertex3 = vertex2;
             while (true)
             {
                 chains[num2].Add(vertex3);
                 dictionary.set_Item(vertex3, 1);
                 ArrayList list2 = this.TopoSortAdjVertices(vertex3, this.cg, dictionary2);
                 vertex3 = this.FirstNotInChain(list2, dictionary);
                 if (vertex3 == null)
                 {
                     goto Label_0112;
                 }
             }
         }
     }
     VertexIntDictionary dictionary3 = new VertexIntDictionary();
     VertexIntDictionary dictionary4 = new VertexIntDictionary();
     this.SetChainPositions(chains, dictionary3, dictionary4);
     VertexListMatrix matrix2 = new VertexListMatrix();
     matrix2.CreateObjectMatrix(this.cg.get_VerticesCount(), chains.RowCount, 0x7fffffff);
     if (vertices.Count > 0)
     {
         for (int j = vertices.Count - 1; j > -1; j--)
         {
             IVertex v = (IVertex) vertices[j];
             foreach (IVertex vertex5 in this.TopoSortAdjVertices(v, this.cg, dictionary2))
             {
                 if (dictionary2.get_Item(vertex5) < ((int) matrix2[v.get_ID()][dictionary3.get_Item(vertex5)]))
                 {
                     this.LeftUnion(matrix2[v.get_ID()], matrix2[vertex5.get_ID()]);
                     matrix2[v.get_ID()][dictionary3.get_Item(vertex5)] = dictionary2.get_Item(vertex5);
                 }
             }
         }
     }
     ArrayList list3 = new ArrayList();
     IEdgeEnumerator enumerator = this.cg.get_Edges().GetEnumerator();
     while (enumerator.MoveNext())
     {
         IEdge edge = enumerator.get_Current();
         list3.Add(edge);
     }
     foreach (IEdge edge2 in list3)
     {
         this.cg.RemoveEdge(edge2);
     }
     IVertexEnumerator enumerator5 = this.cg.get_Vertices().GetEnumerator();
     while (enumerator5.MoveNext())
     {
         IVertex vertex6 = enumerator5.get_Current();
         int num4 = vertex6.get_ID();
         for (int k = 0; k < chains.RowCount; k++)
         {
             int num6 = (int) matrix2[num4][k];
             if (num6 < 0x7fffffff)
             {
                 IVertex vertex7 = (IVertex) vertices[num6];
                 for (int m = dictionary4.get_Item(vertex7); m < chains[k].Count; m++)
                 {
                     this.cg.AddEdge(vertex6, (IVertex) chains[k][m]);
                 }
             }
         }
     }
     this.graphTransitiveClosures = new VertexVertexDictionary();
     IVertexEnumerator enumerator6 = this.visitedGraph.get_Vertices().GetEnumerator();
     while (enumerator6.MoveNext())
     {
         IVertex vertex8 = enumerator6.get_Current();
         if (!this.graphTransitiveClosures.Contains(vertex8))
         {
             IVertex vertex9 = tc.AddVertex();
             this.OnInitTransitiveClosureVertex(new TransitiveClosureVertexEventArgs(vertex8, vertex9));
             this.graphTransitiveClosures.Add(vertex8, vertex9);
         }
     }
     IVertexCollection vertexs = null;
     IVertexEnumerator enumerator7 = this.cg.get_Vertices().GetEnumerator();
     while (enumerator7.MoveNext())
     {
         IVertex vertex10 = enumerator7.get_Current();
         vertexs = (IVertexCollection) algorithm.SCCVerticesMap[vertex10.get_ID()];
         if (vertexs.Count > 1)
         {
             IVertexEnumerator enumerator8 = vertexs.GetEnumerator();
             while (enumerator8.MoveNext())
             {
                 IVertex vertex11 = enumerator8.get_Current();
                 IVertexEnumerator enumerator9 = vertexs.GetEnumerator();
                 while (enumerator9.MoveNext())
                 {
                     IVertex vertex12 = enumerator9.get_Current();
                     this.OnExamineEdge(tc.AddEdge(this.graphTransitiveClosures.get_Item(vertex11), this.graphTransitiveClosures.get_Item(vertex12)));
                 }
             }
         }
         IEdgeEnumerator enumerator10 = this.cg.OutEdges(vertex10).GetEnumerator();
         while (enumerator10.MoveNext())
         {
             IVertex vertex13 = enumerator10.get_Current().get_Target();
             IVertexEnumerator enumerator11 = ((IVertexCollection) algorithm.SCCVerticesMap[vertex10.get_ID()]).GetEnumerator();
             while (enumerator11.MoveNext())
             {
                 IVertex vertex14 = enumerator11.get_Current();
                 IVertexEnumerator enumerator12 = ((IVertexCollection) algorithm.SCCVerticesMap[vertex13.get_ID()]).GetEnumerator();
                 while (enumerator12.MoveNext())
                 {
                     IVertex vertex15 = enumerator12.get_Current();
                     this.OnExamineEdge(tc.AddEdge(this.graphTransitiveClosures.get_Item(vertex14), this.graphTransitiveClosures.get_Item(vertex15)));
                 }
             }
         }
     }
 }
 private IVertex FirstNotInChain(ArrayList adj_topo_vertices, VertexIntDictionary vertices_in_a_chain)
 {
     if (adj_topo_vertices == null)
     {
         throw new ArgumentNullException("Argument <adj_topo_vertices> in function FirstNotInChain cannot be null");
     }
     if (adj_topo_vertices.Count != 0)
     {
         foreach (IVertex vertex in adj_topo_vertices)
         {
             if (vertices_in_a_chain.get_Item(vertex) == 0)
             {
                 return vertex;
             }
         }
     }
     return null;
 }