public override void Init() { CGraphNode newSTNode; m_dfsSpanningTree = CDFSSpanningTree.CreateGraph(); CIt_GraphNodes it = new CIt_GraphNodes(m_sourceGraphs[0]); CIt_GraphRootNodes it1 = new CIt_GraphRootNodes(m_sourceGraphs[0]); // Paint the nodes white color (0) for (it.Begin(); !it.End(); it.Next()) { //CreateInfo(it.M_CurrentItem, // new NodeInfo_DFS(){ m_color = 0}, // this); newSTNode = m_dfsSpanningTree.CreateGraphNode("L" + it.M_CurrentItem.M_Label); newSTNode[m_dfsSpanningTree] = new NodeInfo_DFSSpanningTree() { M_Preorder = 0, M_Postorder = 0 }; m_Mappping.SetOriginalToDerivedNode(it.M_CurrentItem, newSTNode); } // Start at a random node. If the graph is not completely traversed // the Visit function will return and another node ( not already // visited ) will be used as starting node. This works fine for // undirected graphs. For tree graphs it is recomended to start // from the tree root node because a different visiting pattern is // produced for different starting nodes for (it1.Begin(); !it1.End(); it1.Next()) { if (Color(it1.M_CurrentItem) == 0) { Visit(it1.M_CurrentItem); } } }
public override void Init() { AbstractGraphIterator <CGraphNode> it1; if (m_startAtRootNodes) { it1 = new CIt_GraphRootNodes(m_sourceGraphs[0]); } else { it1 = new CIt_GraphNodes(m_sourceGraphs[0]); } // Paint the nodes white color (0) for (it1.Begin(); !it1.End(); it1.Next()) { //CreateInfo(it1.M_CurrentItem, new NodeInfo_DFS(0),this); } // Start at a random node. If the graph is not completely traversed // the Visit function will return and another node ( not already // visited ) will be used as starting node. This works fine for // undirected graphs. For tree graphs it is recomended to start // from the tree root node because a different visiting pattern is // produced for different starting nodes for (it1.Begin(); !it1.End(); it1.Next()) { if (Color(it1.M_CurrentItem) == 0) { Visit(it1.M_CurrentItem); } } // EVENT : Raising the OnInit event OnInit(EventArgs.Empty); }