Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

BCTree.h
Go to the documentation of this file.
1 
32 #pragma once
33 
35 #include <ogdf/basic/EdgeArray.h>
36 #include <ogdf/basic/NodeArray.h>
37 #include <ogdf/basic/SList.h>
38 
39 namespace ogdf {
40 
57 
58 public:
60  enum class GNodeType {
62  Normal,
64  CutVertex
65  };
66 
68  enum class BNodeType {
70  BComp,
72  CComp
73  };
74 
75 protected:
78 
86 
99  mutable Graph m_H;
100 
103  int m_numB;
104 
106  int m_numC;
108 
115 
127 
136 
140 
148 
168 
189 
203 
217 
227 
236 
245 
255 
262  int m_count;
263 
279 
287 
295 
303 
312  void init (node vG);
314 
323  void initNotConnected (node vG);
324 
333  void biComp (adjEntry adjuG, node vG);
334 
342  virtual node parent (node vB) const;
343 
351  node findNCA (node uB, node vB) const;
352 
354 
355 public:
364  explicit BCTree (Graph& G, bool callInitConnected = false) : m_G(G), m_eStack(G.numberOfEdges()) {
365  if (!callInitConnected)
366  init(G.firstNode());
367  else initNotConnected(G.firstNode());
368  }
369 
378  BCTree (Graph& G, node vG, bool callInitConnected = false) : m_G(G), m_eStack(G.numberOfEdges()) {
379  if (!callInitConnected)
380  init(vG);
381  else initNotConnected(vG);
382  }
383 
385  virtual ~BCTree () { }
386 
388  const Graph& originalGraph () const { return m_G; }
390  const Graph& bcTree () const { return m_B; }
392  const Graph& auxiliaryGraph () const { return m_H; }
394 
396  int numberOfBComps () const { return m_numB; }
398  int numberOfCComps () const { return m_numC; }
400 
406  GNodeType typeOfGNode (node vG) const { return m_bNode_type[m_hNode_bNode[m_gNode_hNode[vG]]]==BNodeType::BComp ? GNodeType::Normal : GNodeType::CutVertex; }
407 
420  virtual node bcproper (node vG) const { return m_hNode_bNode[m_gNode_hNode[vG]]; }
421 
429  virtual node bcproper (edge eG) const { return m_hEdge_bNode[m_gEdge_hEdge[eG]]; }
430 
442  node rep (node vG) const { return m_gNode_hNode[vG]; }
443 
450  edge rep (edge eG) const { return m_gEdge_hEdge[eG]; }
452 
459  node original (node vH) { return m_hNode_gNode[vH]; }
460 
467  edge original (edge eH) const { return m_hEdge_gEdge[eH]; }
469 
476  BNodeType typeOfBNode (node vB) const { return m_bNode_type[vB]; }
477 
488  const SList<edge>& hEdges (node vB) const { return m_bNode_hEdges[vB]; }
489 
497  int numberOfEdges (node vB) const { return m_bNode_hEdges[vB].size(); }
498 
507  int numberOfNodes (node vB) const { return m_bNode_numNodes[vB]; }
509 
521  node bComponent (node uG, node vG) const;
522 
532  SList<node>& findPath (node sG, node tG) const;
533 
543  SList<node>* findPathBCTree (node sB, node tB) const;
544 
558  virtual node repVertex (node uG, node vB) const;
559 
589  virtual node cutVertex (node uB, node vB) const;
590 
592 private:
594  BCTree(const BCTree &) = delete;
595 
597  BCTree &operator=(const BCTree &) = delete;
598 };
599 
600 }
Declaration of singly linked lists and iterators.
edge rep(edge eG) const
Returns the edge of the biconnected components graph corresponding to a given edge of the original gr...
Definition: BCTree.h:450
GNodeType
Enumeration type for characterizing the vertices of the original graph.
Definition: BCTree.h:60
int m_count
Definition: BCTree.h:262
NodeArray< node > m_gNode_hNode
An injective mapping vertices(G) -> vertices(H).
Definition: BCTree.h:126
int numberOfBComps() const
Returns the number of B-components.
Definition: BCTree.h:396
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:472
NodeArray< node > m_bNode_hParNode
Array that contains for each BC-tree-vertex the representant of itself within the subgraph in the bic...
Definition: BCTree.h:188
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:99
NodeArray< SList< edge > > m_bNode_hEdges
Array that contains for each BC-tree-vertex a linear list of the edges of the biconnected components ...
Definition: BCTree.h:202
NodeArray< node > m_hNode_gNode
A surjective mapping vertices(H) -> vertices(G).
Definition: BCTree.h:244
BNodeType typeOfBNode(node vB) const
Definition: BCTree.h:476
node firstNode() const
Returns the first node in the list of all nodes.
Definition: Graph_d.h:598
const Graph & auxiliaryGraph() const
Returns the biconnected components graph.
Definition: BCTree.h:392
Dynamic arrays indexed with edges.
Definition: EdgeArray.h:112
Declaration and implementation of bounded stack class.
NodeArray< node > m_bNode_hRefNode
Array that contains for each BC-tree-vertex the representantive of its parent within the subgraph in ...
Definition: BCTree.h:167
BCTree(Graph &G, bool callInitConnected=false)
A constructor.
Definition: BCTree.h:364
Singly linked lists (maintaining the length of the list).
Definition: SList.h:777
NodeArray< BNodeType > m_bNode_type
Array that contains the type of each BC-tree-vertex.
Definition: BCTree.h:139
NodeArray< int > m_lowpt
Temporary array.
Definition: BCTree.h:278
node original(node vH)
Definition: BCTree.h:459
Declaration and implementation of EdgeArray class.
NodeArray< node > m_hNode_bNode
Definition: BCTree.h:226
NodeArray< bool > m_gNode_isMarked
Definition: BCTree.h:114
int m_numC
The number of C-components.
Definition: BCTree.h:106
int size() const
Returns the size (number of elements) of the array.
Definition: Array.h:134
BCTree(Graph &G, node vG, bool callInitConnected=false)
A constructor.
Definition: BCTree.h:378
NodeArray< int > m_number
Temporary array.
Definition: BCTree.h:271
Static BC-trees.
Definition: BCTree.h:56
The parameterized class BoundedStack implements stacks with bounded size.
Definition: BoundedStack.h:46
Class for the representation of edges.
Definition: Graph_d.h:291
virtual node bcproper(node vG) const
Returns a BC-tree-vertex representing a biconnected component which a given vertex of the original gr...
Definition: BCTree.h:420
GNodeType typeOfGNode(node vG) const
Definition: BCTree.h:406
Class for the representation of nodes.
Definition: Graph_d.h:167
Declaration and implementation of NodeArray class.
node rep(node vG) const
Returns a vertex of the biconnected components graph corresponding to a given vertex of the original ...
Definition: BCTree.h:442
BoundedStack< adjEntry > m_eStack
Temporary stack.
Definition: BCTree.h:286
edge original(edge eH) const
Returns the edge of the original graph which a given edge of the biconnected components graph is corr...
Definition: BCTree.h:467
Graph m_B
The BC-tree.
Definition: BCTree.h:85
NodeArray< node > m_gtoh
Temporary array.
Definition: BCTree.h:294
EdgeArray< edge > m_gEdge_hEdge
A bijective mapping edges(G) -> edges(H).
Definition: BCTree.h:134
Graph & m_G
The original graph.
Definition: BCTree.h:77
int numberOfNodes(node vB) const
Returns the number of vertices belonging to the biconnected component represented by a given BC-tree-...
Definition: BCTree.h:507
const SList< edge > & hEdges(node vB) const
Returns a linear list of the edges of the biconnected components graph belonging to the biconnected c...
Definition: BCTree.h:488
BNodeType
Enumeration type for characterizing the BC-tree-vertices.
Definition: BCTree.h:68
int m_numB
The number of B-components.
Definition: BCTree.h:103
EdgeArray< node > m_hEdge_bNode
A surjective mapping edges(H) -> vertices(B).
Definition: BCTree.h:235
SList< node > m_nodes
Temporary list.
Definition: BCTree.h:302
The namespace for all OGDF objects.
virtual node bcproper(edge eG) const
Returns the BC-tree-vertex representing the biconnected component which a given edge of the original ...
Definition: BCTree.h:429
virtual ~BCTree()
Virtual destructor.
Definition: BCTree.h:385
NodeArray< int > m_bNode_numNodes
Array that contains for each BC-tree-vertex the number of vertices belonging to the biconnected compo...
Definition: BCTree.h:215
int numberOfEdges(node vB) const
Returns the number of edges belonging to the biconnected component represented by a given BC-tree-ver...
Definition: BCTree.h:497
const Graph & originalGraph() const
Returns the original graph.
Definition: BCTree.h:388
Class for adjacency list elements.
Definition: Graph_d.h:78
const Graph & bcTree() const
Returns the BC-tree graph.
Definition: BCTree.h:390
int numberOfCComps() const
Returns the number of C-components.
Definition: BCTree.h:398
NodeArray< bool > m_bNode_isMarked
Array of marks for the BC-tree-vertices.
Definition: BCTree.h:147
Graph m_H
The biconnected components graph.
Definition: BCTree.h:99
EdgeArray< edge > m_hEdge_gEdge
A bijective mapping edges(H) -> edges(G).
Definition: BCTree.h:253