public void SaveGraphToFile(FeatherVaneGraph data, int width, int height, string filename) { Graph gleeGraph = CreateGraph(data); var renderer = new GraphRenderer(gleeGraph); renderer.CalculateLayout(); var bitmap = new Bitmap(width, height, PixelFormat.Format32bppArgb); renderer.Render(bitmap); bitmap.Save(filename, ImageFormat.Png); }
public Graph CreateGraph(FeatherVaneGraph data) { var graph = new AdjacencyGraph<Vertex, Edge<Vertex>>(); graph.AddVertexRange(data.Vertices); graph.AddEdgeRange(data.Edges.Select(x => new Edge<Vertex>(x.From, x.To))); GleeGraphPopulator<Vertex, Edge<Vertex>> glee = graph.CreateGleePopulator(); glee.NodeAdded += NodeStyler; glee.EdgeAdded += EdgeStyler; glee.Compute(); Graph gleeGraph = glee.GleeGraph; return gleeGraph; }
public static void TestShowVisualizer(FeatherVaneGraph data) { var visualizerHost = new VisualizerDevelopmentHost(data, typeof(VaneDebugVisualizer)); visualizerHost.ShowVisualizer(); }