Open
Graph Drawing
Framework

 v.2012.05
 

BCTree.h
Go to the documentation of this file.
00001 /*
00002  * $Revision: 2299 $
00003  * 
00004  * last checkin:
00005  *   $Author: gutwenger $ 
00006  *   $Date: 2012-05-07 15:57:08 +0200 (Mon, 07 May 2012) $ 
00007  ***************************************************************/
00008  
00043 #ifdef _MSC_VER
00044 #pragma once
00045 #endif
00046 
00047 #ifndef OGDF_BC_TREE_H
00048 #define OGDF_BC_TREE_H
00049 
00050 #include <ogdf/basic/BoundedStack.h>
00051 #include <ogdf/basic/EdgeArray.h>
00052 #include <ogdf/basic/NodeArray.h>
00053 #include <ogdf/basic/SList.h>
00054 
00055 namespace ogdf {
00056 
00070 class OGDF_EXPORT BCTree {
00071 
00072 public:
00073 
00084     enum GNodeType { Normal, CutVertex };
00094     enum BNodeType { BComp, CComp };
00095 
00096 protected:
00097 
00101     Graph& m_G;
00108     Graph m_B;
00121     mutable Graph m_H;
00122 
00126     int m_numB;
00130     int m_numC;
00131 
00137     NodeArray<bool> m_gNode_isMarked;
00148     NodeArray<node> m_gNode_hNode;
00155     EdgeArray<edge> m_gEdge_hEdge;
00156 
00160     NodeArray<BNodeType> m_bNode_type;
00167     mutable NodeArray<bool> m_bNode_isMarked;
00186     NodeArray<node> m_bNode_hRefNode;
00206     NodeArray<node> m_bNode_hParNode;
00219     NodeArray<SList<edge> > m_bNode_hEdges;
00231     NodeArray<int> m_bNode_numNodes;
00232 
00241     mutable NodeArray<node> m_hNode_bNode;
00249     mutable EdgeArray<node> m_hEdge_bNode;
00257     NodeArray<node> m_hNode_gNode;
00265     EdgeArray<edge> m_hEdge_gEdge;
00266 
00273     int m_count;
00280     NodeArray<int> m_number;
00287     NodeArray<int> m_lowpt;
00294     BoundedStack<adjEntry> m_eStack;
00301     NodeArray<node> m_gtoh;
00308     SList<node> m_nodes;
00309 
00318     void init (node vG);
00319     
00328     void initNotConnected (node vG);
00337     void biComp (adjEntry adjuG, node vG);
00338 
00346     virtual node parent (node vB) const;
00354     node findNCA (node uB, node vB) const;
00355 
00356 public:
00357 
00366     BCTree (Graph& G, bool callInitConnected = false) : m_G(G), m_eStack(G.numberOfEdges()) { 
00367         if (!callInitConnected) 
00368             init(G.firstNode()); 
00369         else initNotConnected(G.firstNode());
00370     }
00371     
00380     BCTree (Graph& G, node vG, bool callInitConnected = false) : m_G(G), m_eStack(G.numberOfEdges()) { 
00381         if (!callInitConnected) 
00382             init(vG); 
00383         else initNotConnected(vG);
00384     }
00385     
00389     virtual ~BCTree () { }
00390 
00395     const Graph& originalGraph () const { return m_G; }
00400     const Graph& bcTree () const { return m_B; }
00405     const Graph& auxiliaryGraph () const { return m_H; }
00406 
00411     int numberOfBComps () const { return m_numB; }
00416     int numberOfCComps () const { return m_numC; }
00417 
00423     GNodeType typeOfGNode (node vG) const { return m_bNode_type[m_hNode_bNode[m_gNode_hNode[vG]]]==BComp ? Normal : CutVertex; }
00436     virtual node bcproper (node vG) const { return m_hNode_bNode[m_gNode_hNode[vG]]; }
00444     virtual node bcproper (edge eG) const { return m_hEdge_bNode[m_gEdge_hEdge[eG]]; }
00456     node rep (node vG) const { return m_gNode_hNode[vG]; }
00463     edge rep (edge eG) const { return m_gEdge_hEdge[eG]; }
00464 
00471     node original (node vH) { return m_hNode_gNode[vH]; }
00478     edge original (edge eH) const { return m_hEdge_gEdge[eH]; }
00479 
00486     BNodeType typeOfBNode (node vB) const { return m_bNode_type[vB]; }
00497     const SList<edge>& hEdges (node vB) const { return m_bNode_hEdges[vB]; }
00505     int numberOfEdges (node vB) const { return m_bNode_hEdges[vB].size(); }
00514     int numberOfNodes (node vB) const { return m_bNode_numNodes[vB]; }
00515 
00527     node bComponent (node uG, node vG) const;
00528     
00538     SList<node>& findPath (node sG, node tG) const;
00539     
00549     SList<node>* findPathBCTree (node sB, node tB) const;
00550 
00564     virtual node repVertex (node uG, node vB) const;
00594     virtual node cutVertex (node uB, node vB) const;
00595 
00598 private:
00599     // avoid automatic creation of assignment operator
00600 
00602     BCTree(const BCTree &);
00603 
00605     BCTree &operator=(const BCTree &);
00606 };
00607 
00608 }
00609 
00610 #endif