public override void Init() { // Create output graph AddOutputGraph(m_condensedGraph); // TODO!!! Check the existence of none unique nodes per condensed node // TODO!!!!! CIt_GraphEdges it = new CIt_GraphEdges(m_sourceGraph); CGraphEdge edge, newEdge; CGraphNode newNode; CCondensedGraph newgraph = new CCondensedGraph(originalGraph); // Add condensed nodes foreach (List <CGraphNode> condensedNodeContent in condensedNodeContents) { newNode = newgraph.CreateGraphNode(condensedNodeContent); } // Add condensed edges for (edge = it.Begin(); !it.End(); edge = it.Next()) { // Map the original graph edge to a condensed graph edge newEdge = newgraph.AddCondensedEdge(edge); if (newEdge != null) { } } return(newgraph); }
/// <summary> /// THis method iterates over the remaining extended basic block roots /// and calls visit to assemble the block for each root /// </summary> public override void Init() { int nRoots = m_sourceGraph.GetRootNodes(m_ebbRoots); if (nRoots != 1) { throw new Exception("Wrong type of graph!!! Only single rooted graphs accepted"); } // For all extended basic block leaders while (m_ebbRoots.Count != 0) { // Take the first leader... CGraphNode x = m_ebbRoots.First(); //... and remove it from the list m_ebbRoots.RemoveAt(0); // If leader hasn't already been considered if (!m_allEbbs.ContainsKey(x)) { // Add new extended basic block entry in EbbRoots m_currentEbb = m_allEbbs[x] = new List <CGraphNode>(); // Insert leader to the extended basic block Visit(x); } } // Create exdended basic block graph m_extendedBasicBlockGraph = CCondensedGraph.CreateGraph(m_sourceGraph, m_allEbbs.Values); AddOutputGraph(m_extendedBasicBlockGraph); // Print graph m_extendedBasicBlockGraph.RegisterGraphPrinter(new CCondensedGraphVizPrinter(m_extendedBasicBlockGraph, new CCondensedGraphVizLabelling("cluster", m_extendedBasicBlockGraph))); m_extendedBasicBlockGraph.Generate("extended basic block graph.dot", true); }