public static IVertexAndEdgeListGraph <int, TravelEdge> ToDirectedGrpah(this UndirectedGraph <int, TravelEdge> g) { var directed = new QuickGraph.AdjacencyGraph <int, TravelEdge>(); directed.AddVerticesAndEdgeRange(g.Edges); foreach (var edge in g.Edges) { directed.AddEdge(new TravelEdge(edge.Target, edge.Source)); } return(directed); }
public static void SaveToDot(StaticFlow sFlow, DynamicFlow dFlow, string filename) { var displayGraph = new QuickGraph.AdjacencyGraph <string, TaggedEdge <string, string> >(); foreach (var vertex in dFlow.Graph.Vertices) { displayGraph.AddVertex(vertex); } foreach (var edge in dFlow.Graph.Edges) { int lineNumber = dFlow.LineNumber(edge.Source); string displayInfo = sFlow.Get_Line_Str(lineNumber) + "\n" + edge.Tag.StateUpdate.ToString2(); displayGraph.AddEdge(new TaggedEdge <string, string>(edge.Source, edge.Target, displayInfo)); } DotVisualizer.Visualize(displayGraph, filename); }