private static Dictionary <string, VertexData> InitDraw(Graph <string, VertexData, string, EdgeData> graph, DrawGraph drawer) { drawer.ClearCanvas(); var vertices = graph.Vertices; Dictionary <string, VertexData> mappedVertices = new Dictionary <string, VertexData>(); foreach (var v in vertices) { mappedVertices.Add(v.Key, v.Data); } drawer.SetGraphSize(CalculateGraphSize(mappedVertices)); return(mappedVertices); }
public static void DrawWithPath(this Graph <string, VertexData, string, EdgeData> graph, DrawGraph drawer, List <string> path) { if (graph.VerticesCount() > 1000) { drawer.ClearCanvas(); drawer.DrawWarning(Resources.CannotDrawGraph); return; } Dictionary <string, VertexData> mappedVertices = InitDraw(graph, drawer); if (mappedVertices.Count <= 0) { return; } DrawEdges(drawer, mappedVertices, graph.Edges); if (path != null) { DrawPath(drawer, mappedVertices, path); } DrawVertices(drawer, mappedVertices); }