Open
Graph Drawing
Framework

 v.2010.10
 

BCTree.h

Go to the documentation of this file.
00001 /*
00002  * $Revision: 2027 $
00003  * 
00004  * last checkin:
00005  *   $Author: gutwenger $ 
00006  *   $Date: 2010-09-01 11:55:17 +0200 (Wed, 01 Sep 2010) $ 
00007  ***************************************************************/
00008  
00053 #ifdef _MSC_VER
00054 #pragma once
00055 #endif
00056 
00057 #ifndef OGDF_BC_TREE_H
00058 #define OGDF_BC_TREE_H
00059 
00060 #include <ogdf/basic/BoundedStack.h>
00061 #include <ogdf/basic/EdgeArray.h>
00062 #include <ogdf/basic/NodeArray.h>
00063 #include <ogdf/basic/SList.h>
00064 
00065 namespace ogdf {
00066 
00080 class OGDF_EXPORT BCTree {
00081 
00082 public:
00083 
00094     enum GNodeType { Normal, CutVertex };
00104     enum BNodeType { BComp, CComp };
00105 
00106 protected:
00107 
00111     Graph& m_G;
00118     Graph m_B;
00131     mutable Graph m_H;
00132 
00136     int m_numB;
00140     int m_numC;
00141 
00147     NodeArray<bool> m_gNode_isMarked;
00158     NodeArray<node> m_gNode_hNode;
00165     EdgeArray<edge> m_gEdge_hEdge;
00166 
00170     NodeArray<BNodeType> m_bNode_type;
00177     mutable NodeArray<bool> m_bNode_isMarked;
00196     NodeArray<node> m_bNode_hRefNode;
00216     NodeArray<node> m_bNode_hParNode;
00229     NodeArray<SList<edge> > m_bNode_hEdges;
00241     NodeArray<int> m_bNode_numNodes;
00242 
00251     mutable NodeArray<node> m_hNode_bNode;
00259     mutable EdgeArray<node> m_hEdge_bNode;
00267     NodeArray<node> m_hNode_gNode;
00275     EdgeArray<edge> m_hEdge_gEdge;
00276 
00283     int m_count;
00290     NodeArray<int> m_number;
00297     NodeArray<int> m_lowpt;
00304     BoundedStack<adjEntry> m_eStack;
00311     NodeArray<node> m_gtoh;
00318     SList<node> m_nodes;
00319 
00328     void init (node vG);
00329     
00338     void initNotConnected (node vG);
00347     void biComp (adjEntry adjuG, node vG);
00348 
00356     virtual node parent (node vB) const;
00364     node findNCA (node uB, node vB) const;
00365 
00366 public:
00367 
00376     BCTree (Graph& G, bool callInitConnected = false) : m_G(G), m_eStack(G.numberOfEdges()) { 
00377         if (!callInitConnected) 
00378             init(G.firstNode()); 
00379         else initNotConnected(G.firstNode());
00380     }
00381     
00390     BCTree (Graph& G, node vG, bool callInitConnected = false) : m_G(G), m_eStack(G.numberOfEdges()) { 
00391         if (!callInitConnected) 
00392             init(vG); 
00393         else initNotConnected(vG);
00394     }
00395     
00399     virtual ~BCTree () { }
00400 
00405     const Graph& originalGraph () const { return m_G; }
00410     const Graph& bcTree () const { return m_B; }
00415     const Graph& auxiliaryGraph () const { return m_H; }
00416 
00421     int numberOfBComps () const { return m_numB; }
00426     int numberOfCComps () const { return m_numC; }
00427 
00433     GNodeType typeOfGNode (node vG) const { return m_bNode_type[m_hNode_bNode[m_gNode_hNode[vG]]]==BComp ? Normal : CutVertex; }
00446     virtual node bcproper (node vG) const { return m_hNode_bNode[m_gNode_hNode[vG]]; }
00454     virtual node bcproper (edge eG) const { return m_hEdge_bNode[m_gEdge_hEdge[eG]]; }
00466     node rep (node vG) const { return m_gNode_hNode[vG]; }
00473     edge rep (edge eG) const { return m_gEdge_hEdge[eG]; }
00474 
00481     node original (node vH) { return m_hNode_gNode[vH]; }
00488     edge original (edge eH) const { return m_hEdge_gEdge[eH]; }
00489 
00496     BNodeType typeOfBNode (node vB) const { return m_bNode_type[vB]; }
00507     const SList<edge>& hEdges (node vB) const { return m_bNode_hEdges[vB]; }
00515     int numberOfEdges (node vB) const { return m_bNode_hEdges[vB].size(); }
00524     int numberOfNodes (node vB) const { return m_bNode_numNodes[vB]; }
00525 
00537     node bComponent (node uG, node vG) const;
00538     
00548     SList<node>& findPath (node sG, node tG) const;
00549     
00559     SList<node>* findPathBCTree (node sB, node tB) const;
00560 
00574     virtual node repVertex (node uG, node vB) const;
00604     virtual node cutVertex (node uB, node vB) const;
00605 
00608 private:
00609     // avoid automatic creation of assignment operator
00610 
00612     BCTree(const BCTree &);
00613 
00615     BCTree &operator=(const BCTree &);
00616 };
00617 
00618 }
00619 
00620 #endif