Open
Graph Drawing
Framework

 v.2012.07
 

BCTree.h
Go to the documentation of this file.
1 /*
2  * $Revision: 2523 $
3  *
4  * last checkin:
5  * $Author: gutwenger $
6  * $Date: 2012-07-02 20:59:27 +0200 (Mon, 02 Jul 2012) $
7  ***************************************************************/
8 
44 #ifdef _MSC_VER
45 #pragma once
46 #endif
47 
48 #ifndef OGDF_BC_TREE_H
49 #define OGDF_BC_TREE_H
50 
52 #include <ogdf/basic/EdgeArray.h>
53 #include <ogdf/basic/NodeArray.h>
54 #include <ogdf/basic/SList.h>
55 
56 namespace ogdf {
57 
72 
73 public:
74 
85  enum GNodeType { Normal, CutVertex };
95  enum BNodeType { BComp, CComp };
96 
97 protected:
98 
122  mutable Graph m_H;
123 
127  int m_numB;
131  int m_numC;
132 
157 
233 
267 
274  int m_count;
310 
319  void init (node vG);
320 
329  void initNotConnected (node vG);
338  void biComp (adjEntry adjuG, node vG);
339 
347  virtual node parent (node vB) const;
355  node findNCA (node uB, node vB) const;
356 
357 public:
358 
367  BCTree (Graph& G, bool callInitConnected = false) : m_G(G), m_eStack(G.numberOfEdges()) {
368  if (!callInitConnected)
369  init(G.firstNode());
370  else initNotConnected(G.firstNode());
371  }
372 
381  BCTree (Graph& G, node vG, bool callInitConnected = false) : m_G(G), m_eStack(G.numberOfEdges()) {
382  if (!callInitConnected)
383  init(vG);
384  else initNotConnected(vG);
385  }
386 
390  virtual ~BCTree () { }
391 
396  const Graph& originalGraph () const { return m_G; }
401  const Graph& bcTree () const { return m_B; }
406  const Graph& auxiliaryGraph () const { return m_H; }
407 
412  int numberOfBComps () const { return m_numB; }
417  int numberOfCComps () const { return m_numC; }
418 
424  GNodeType typeOfGNode (node vG) const { return m_bNode_type[m_hNode_bNode[m_gNode_hNode[vG]]]==BComp ? Normal : CutVertex; }
437  virtual node bcproper (node vG) const { return m_hNode_bNode[m_gNode_hNode[vG]]; }
445  virtual node bcproper (edge eG) const { return m_hEdge_bNode[m_gEdge_hEdge[eG]]; }
457  node rep (node vG) const { return m_gNode_hNode[vG]; }
464  edge rep (edge eG) const { return m_gEdge_hEdge[eG]; }
465 
472  node original (node vH) { return m_hNode_gNode[vH]; }
479  edge original (edge eH) const { return m_hEdge_gEdge[eH]; }
480 
487  BNodeType typeOfBNode (node vB) const { return m_bNode_type[vB]; }
498  const SList<edge>& hEdges (node vB) const { return m_bNode_hEdges[vB]; }
506  int numberOfEdges (node vB) const { return m_bNode_hEdges[vB].size(); }
515  int numberOfNodes (node vB) const { return m_bNode_numNodes[vB]; }
516 
528  node bComponent (node uG, node vG) const;
529 
539  SList<node>& findPath (node sG, node tG) const;
540 
550  SList<node>* findPathBCTree (node sB, node tB) const;
551 
565  virtual node repVertex (node uG, node vB) const;
595  virtual node cutVertex (node uB, node vB) const;
596 
599 private:
600  // avoid automatic creation of assignment operator
601 
603  BCTree(const BCTree &);
604 
606  BCTree &operator=(const BCTree &);
607 };
608 
609 }
610 
611 #endif