Ejemplo n.º 1
0
 /// <summary>
 /// Creates a deepcopy of this graph
 /// </summary>
 /// <returns>Graph</returns>
 public DirectedGraph DeepCopy()
 {
     var copy = new DirectedGraph(Vertices());
     for (int e = 0; e < addedEdges.Count; e++)
     {
         copy.AddEdge(addedEdges[e][0], addedEdges[e][1]);
     }
     return copy;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Reverse the directed edges in the graph
 /// </summary>
 /// <returns></returns>
 public DirectedGraph Reverse()
 {
     var reversedGraph = new DirectedGraph(vertices);
     for (int v = 0; v < vertices; v++)
     {
         foreach (var w in AdjecentVertices(v))
         {
             reversedGraph.AddEdge(w, v);
         }
     }
     return reversedGraph;
 }