public CondensedTypeGraph CondenseGraph() { CondensationGraphAlgorithm cgalgo = new CondensationGraphAlgorithm(this); cgalgo.InitCondensationGraphVertex += new CondensationGraphVertexEventHandler(CGVertexHandler); CondensedTypeGraph cg = new CondensedTypeGraph(); cgalgo.Create(cg); return(cg); }
/// <summary> /// entry point for the application. /// </summary> public void Test(string outputImageFolder) { AdjacencyGraph g = new AdjacencyGraph(new MyVertexProvider(), new EdgeProvider(), true); MyVertex[] v = new MyVertex[12]; for (int i = 0; i < 12; i++) { v[i] = (MyVertex)g.AddVertex(); v[i].Name = "Vertex " + i; v[i].Value = i; } g.AddEdge(v[0], v[1]); g.AddEdge(v[1], v[2]); g.AddEdge(v[2], v[3]); g.AddEdge(v[3], v[0]); g.AddEdge(v[2], v[0]); g.AddEdge(v[4], v[5]); g.AddEdge(v[5], v[6]); g.AddEdge(v[6], v[7]); g.AddEdge(v[7], v[4]); g.AddEdge(v[2], v[5]); g.AddEdge(v[8], v[9]); g.AddEdge(v[9], v[8]); g.AddEdge(v[10], v[11]); g.AddEdge(v[11], v[10]); g.AddEdge(v[2], v[9]); g.AddEdge(v[9], v[10]); GraphvizAlgorithm renderer = new GraphvizAlgorithm(g, outputImageFolder, NGraphviz.Helpers.GraphvizImageType.Jpeg); renderer.FormatVertex += new FormatVertexEventHandler(FormatGraph); renderer.Write("Original_Graph.jpeg"); CondensationGraphAlgorithm cgalgo = new CondensationGraphAlgorithm(g); cgalgo.InitCondensationGraphVertex += new CondensationGraphVertexEventHandler(CGVertexHandler); AdjacencyGraph cg = new AdjacencyGraph(new MyVertexProvider(), new EdgeProvider(), true); cgalgo.Create(cg); // Render the Condensation Graph renderer = new GraphvizAlgorithm(cg, outputImageFolder, NGraphviz.Helpers.GraphvizImageType.Jpeg); renderer.FormatVertex += new FormatVertexEventHandler(FormatGraph); renderer.Write("CG.jpeg"); }