Open
Graph Drawing
Framework

 v. 2020.02 (Catalpa)
 

BCTree.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/EdgeArray.h>
35 #include <ogdf/basic/NodeArray.h>
36 #include <ogdf/basic/SList.h>
37 
38 namespace ogdf {
39 
56 
57 public:
59  enum class GNodeType {
61  Normal,
63  CutVertex
64  };
65 
67  enum class BNodeType {
69  BComp,
71  CComp
72  };
73 
74 protected:
77 
85 
98  mutable Graph m_H;
99 
102  int m_numB;
103 
105  int m_numC;
107 
114 
126 
135 
139 
147 
167 
188 
202 
216 
226 
235 
244 
254 
261  int m_count;
262 
278 
286 
294 
302 
311  void init (node vG);
313 
322  void initNotConnected (node vG);
323 
332  void biComp (adjEntry adjuG, node vG);
333 
341  virtual node parent (node vB) const;
342 
350  node findNCA (node uB, node vB) const;
351 
353 
354 public:
363  explicit BCTree (Graph& G, bool callInitConnected = false) : m_G(G), m_eStack(G.numberOfEdges()) {
364  if (!callInitConnected) {
365  init(G.firstNode());
366  }
367  else {
368  initNotConnected(G.firstNode());
369  }
370  }
371 
380  BCTree (Graph& G, node vG, bool callInitConnected = false) : m_G(G), m_eStack(G.numberOfEdges()) {
381  if (!callInitConnected)
382  init(vG);
383  else initNotConnected(vG);
384  }
385 
387  virtual ~BCTree () { }
388 
390  const Graph& originalGraph () const { return m_G; }
392  const Graph& bcTree () const { return m_B; }
394  const Graph& auxiliaryGraph () const { return m_H; }
396 
398  int numberOfBComps () const { return m_numB; }
400  int numberOfCComps () const { return m_numC; }
402 
408  GNodeType typeOfGNode (node vG) const { return m_bNode_type[m_hNode_bNode[m_gNode_hNode[vG]]]==BNodeType::BComp ? GNodeType::Normal : GNodeType::CutVertex; }
409 
422  virtual node bcproper (node vG) const { return m_hNode_bNode[m_gNode_hNode[vG]]; }
423 
431  virtual node bcproper (edge eG) const { return m_hEdge_bNode[m_gEdge_hEdge[eG]]; }
432 
444  node rep (node vG) const { return m_gNode_hNode[vG]; }
445 
452  edge rep (edge eG) const { return m_gEdge_hEdge[eG]; }
454 
461  node original (node vH) { return m_hNode_gNode[vH]; }
462 
469  edge original (edge eH) const { return m_hEdge_gEdge[eH]; }
471 
478  BNodeType typeOfBNode (node vB) const { return m_bNode_type[vB]; }
479 
490  const SList<edge>& hEdges (node vB) const { return m_bNode_hEdges[vB]; }
491 
499  int numberOfEdges (node vB) const { return m_bNode_hEdges[vB].size(); }
500 
509  int numberOfNodes (node vB) const { return m_bNode_numNodes[vB]; }
511 
523  node bComponent (node uG, node vG) const;
524 
534  SList<node>& findPath (node sG, node tG) const;
535 
545  SList<node>* findPathBCTree (node sB, node tB) const;
546 
560  virtual node repVertex (node uG, node vB) const;
561 
591  virtual node cutVertex (node uB, node vB) const;
592 
594 private:
596  BCTree(const BCTree &) = delete;
597 
599  BCTree &operator=(const BCTree &) = delete;
600 
601  void initBasic(node vG);
602  void initEdges();
603 };
604 
605 }
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:452
GNodeType
Enumeration type for characterizing the vertices of the original graph.
Definition: BCTree.h:59
int m_count
Definition: BCTree.h:261
NodeArray< node > m_gNode_hNode
An injective mapping vertices(G) -> vertices(H).
Definition: BCTree.h:125
int numberOfBComps() const
Returns the number of B-components.
Definition: BCTree.h:398
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:492
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:187
#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:201
NodeArray< node > m_hNode_gNode
A surjective mapping vertices(H) -> vertices(G).
Definition: BCTree.h:243
BNodeType typeOfBNode(node vB) const
Definition: BCTree.h:478
node firstNode() const
Returns the first node in the list of all nodes.
Definition: Graph_d.h:618
An array that keeps track of the number of inserted elements; also usable as an efficient stack...
Definition: Array.h:45
const Graph & auxiliaryGraph() const
Returns the biconnected components graph.
Definition: BCTree.h:394
Dynamic arrays indexed with edges.
Definition: EdgeArray.h:112
void init()
Definition: graphics.h:472
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:166
BCTree(Graph &G, bool callInitConnected=false)
A constructor.
Definition: BCTree.h:363
Singly linked lists (maintaining the length of the list).
Definition: SList.h:773
NodeArray< BNodeType > m_bNode_type
Array that contains the type of each BC-tree-vertex.
Definition: BCTree.h:138
NodeArray< int > m_lowpt
Temporary array.
Definition: BCTree.h:277
node original(node vH)
Definition: BCTree.h:461
Declaration and implementation of EdgeArray class.
NodeArray< node > m_hNode_bNode
Definition: BCTree.h:225
NodeArray< bool > m_gNode_isMarked
Definition: BCTree.h:113
int m_numC
The number of C-components.
Definition: BCTree.h:105
int size() const
Returns the size (number of elements) of the array.
Definition: Array.h:282
BCTree(Graph &G, node vG, bool callInitConnected=false)
A constructor.
Definition: BCTree.h:380
NodeArray< int > m_number
Temporary array.
Definition: BCTree.h:270
Static BC-trees.
Definition: BCTree.h:55
Class for the representation of edges.
Definition: Graph_d.h:292
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:422
GNodeType typeOfGNode(node vG) const
Definition: BCTree.h:408
Class for the representation of nodes.
Definition: Graph_d.h:169
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:444
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:469
Graph m_B
The BC-tree.
Definition: BCTree.h:84
NodeArray< node > m_gtoh
Temporary array.
Definition: BCTree.h:293
EdgeArray< edge > m_gEdge_hEdge
A bijective mapping edges(G) -> edges(H).
Definition: BCTree.h:133
Graph & m_G
The original graph.
Definition: BCTree.h:76
int numberOfNodes(node vB) const
Returns the number of vertices belonging to the biconnected component represented by a given BC-tree-...
Definition: BCTree.h:509
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:490
BNodeType
Enumeration type for characterizing the BC-tree-vertices.
Definition: BCTree.h:67
int m_numB
The number of B-components.
Definition: BCTree.h:102
ArrayBuffer< adjEntry > m_eStack
Temporary stack.
Definition: BCTree.h:285
EdgeArray< node > m_hEdge_bNode
A surjective mapping edges(H) -> vertices(B).
Definition: BCTree.h:234
SList< node > m_nodes
Temporary list.
Definition: BCTree.h:301
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:431
virtual ~BCTree()
Virtual destructor.
Definition: BCTree.h:387
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:214
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:499
const Graph & originalGraph() const
Returns the original graph.
Definition: BCTree.h:390
Class for adjacency list elements.
Definition: Graph_d.h:79
const Graph & bcTree() const
Returns the BC-tree graph.
Definition: BCTree.h:392
int numberOfCComps() const
Returns the number of C-components.
Definition: BCTree.h:400
NodeArray< bool > m_bNode_isMarked
Array of marks for the BC-tree-vertices.
Definition: BCTree.h:146
Graph m_H
The biconnected components graph.
Definition: BCTree.h:98
EdgeArray< edge > m_hEdge_gEdge
A bijective mapping edges(H) -> edges(G).
Definition: BCTree.h:252