Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

BCTree.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/ArrayBuffer.h>
35 #include <ogdf/basic/Graph.h>
36 #include <ogdf/basic/SList.h>
37 #include <ogdf/basic/basic.h>
38 
39 #include <iosfwd>
40 
41 namespace ogdf {
42 template<class E>
43 class List;
44 
61 public:
63  enum class GNodeType {
65  Normal,
67  CutVertex
68  };
69 
71  enum class BNodeType {
73  BComp,
75  CComp
76  };
77 
78 protected:
81 
89 
102  mutable Graph m_H;
103 
106  int m_numB;
107 
109  int m_numC;
111 
118 
130 
139 
143 
151 
171 
192 
206 
220 
230 
239 
248 
258 
265  int m_count;
266 
282 
290 
298 
306 
315  void init(node vG);
317 
326  void initNotConnected(node vG);
327 
337  void initNotConnected(List<node>& vG);
338 
347  void biComp(adjEntry adjuG, node vG);
348 
356  virtual node parent(node vB) const;
357 
365  node findNCA(node uB, node vB) const;
366 
368 
369 public:
378  explicit BCTree(Graph& G, bool not_connected = false) : BCTree(G, nullptr, not_connected) {};
379 
389  BCTree(Graph& G, node vG, bool not_connected = false) : m_G(G), m_eStack(G.numberOfEdges()) {
390  if (vG == nullptr) {
391  vG = G.firstNode();
392  }
393  if (not_connected) {
394  initNotConnected(vG);
395  } else {
396  init(vG);
397  }
398  }
399 
410  BCTree(Graph& G, List<node>& vG) : m_G(G), m_eStack(G.numberOfEdges()) { initNotConnected(vG); }
411 
413  virtual ~BCTree() { }
414 
415  BCTree(const BCTree& copy) = delete;
416  BCTree(BCTree&& move) = delete;
417  BCTree& operator=(const BCTree& copy) = delete;
418  BCTree& operator=(BCTree&& move) = delete;
419 
422  const Graph& originalGraph() const { return m_G; }
423 
425  const Graph& bcTree() const { return m_B; }
426 
428  const Graph& auxiliaryGraph() const { return m_H; }
429 
431 
434  int numberOfBComps() const { return m_numB; }
435 
437  int numberOfCComps() const { return m_numC; }
438 
440 
447  return m_bNode_type[m_hNode_bNode[m_gNode_hNode[vG]]] == BNodeType::BComp
448  ? GNodeType::Normal
449  : GNodeType::CutVertex;
450  }
451 
464  node bcproper(node vG) const { return bccomp(m_gNode_hNode[vG]); }
465 
473  node bcproper(edge eG) const { return bccomp(m_gEdge_hEdge[eG]); }
474 
487  virtual node bccomp(node vH) const { return m_hNode_bNode[vH]; }
488 
496  virtual node bccomp(edge eH) const { return m_hEdge_bNode[eH]; }
497 
509  node rep(node vG) const { return m_gNode_hNode[vG]; }
510 
517  edge rep(edge eG) const { return m_gEdge_hEdge[eG]; }
518 
520 
527  node original(node vH) const { return m_hNode_gNode[vH]; }
528 
535  edge original(edge eH) const { return m_hEdge_gEdge[eH]; }
536 
538 
545  BNodeType typeOfBNode(node vB) const { return m_bNode_type[vB]; }
546 
557  const SList<edge>& hEdges(node vB) const { return m_bNode_hEdges[vB]; }
558 
566  int numberOfEdges(node vB) const { return m_bNode_hEdges[vB].size(); }
567 
576  int numberOfNodes(node vB) const { return m_bNode_numNodes[vB]; }
577 
579 
591  node bComponent(node uG, node vG) const;
592 
602  SList<node>& findPath(node sG, node tG) const;
603 
613  SList<node>* findPathBCTree(node sB, node tB) const;
614 
628  virtual node repVertex(node uG, node vB) const;
629 
659  virtual node cutVertex(node uB, node vB) const;
660 
662 
663 #ifdef OGDF_DEBUG
664  void consistencyCheck() const;
666 #endif
667 
668 private:
669  void initBasic(node vG);
670  void initEdges();
671 };
672 
673 OGDF_EXPORT std::ostream& operator<<(std::ostream& os, const BCTree::BNodeType& obj);
674 
675 OGDF_EXPORT std::ostream& operator<<(std::ostream& os, const BCTree::GNodeType& obj);
676 
677 }
ogdf::ArrayBuffer
An array that keeps track of the number of inserted elements; also usable as an efficient stack.
Definition: Array.h:53
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
ogdf::BCTree::bcTree
const Graph & bcTree() const
Returns the BC-tree graph.
Definition: BCTree.h:425
ogdf::BCTree::numberOfCComps
int numberOfCComps() const
Returns the number of C-components.
Definition: BCTree.h:437
ogdf::BCTree::m_hNode_gNode
NodeArray< node > m_hNode_gNode
A surjective mapping vertices(H) -> vertices(G).
Definition: BCTree.h:247
ArrayBuffer.h
Declaration and implementation of ArrayBuffer class.
ogdf::BCTree
Static BC-trees.
Definition: BCTree.h:60
ogdf::BCTree::original
node original(node vH) const
Definition: BCTree.h:527
Graph.h
Includes declaration of graph class.
ogdf::BCTree::GNodeType
GNodeType
Enumeration type for characterizing the vertices of the original graph.
Definition: BCTree.h:63
ogdf::BCTree::m_bNode_hEdges
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:205
ogdf::BCTree::m_count
int m_count
Definition: BCTree.h:265
ogdf::BCTree::m_gNode_hNode
NodeArray< node > m_gNode_hNode
An injective mapping vertices(G) -> vertices(H).
Definition: BCTree.h:129
ogdf::BCTree::m_hEdge_gEdge
EdgeArray< edge > m_hEdge_gEdge
A bijective mapping edges(H) -> edges(G).
Definition: BCTree.h:256
ogdf::BCTree::m_bNode_hParNode
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:191
ogdf::BCTree::rep
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:517
ogdf::SList
Singly linked lists (maintaining the length of the list).
Definition: SList.h:845
ogdf::BCTree::auxiliaryGraph
const Graph & auxiliaryGraph() const
Returns the biconnected components graph.
Definition: BCTree.h:428
ogdf::BCTree::numberOfBComps
int numberOfBComps() const
Returns the number of B-components.
Definition: BCTree.h:434
ogdf::BCTree::m_bNode_hRefNode
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:170
ogdf::BCTree::bcproper
node bcproper(edge eG) const
Returns the BC-tree-vertex representing the biconnected component which a given edge of the original ...
Definition: BCTree.h:473
ogdf::BCTree::bcproper
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:464
ogdf::BCTree::BCTree
BCTree(Graph &G, List< node > &vG)
Constructor for not connected graphs.
Definition: BCTree.h:410
ogdf::BCTree::typeOfBNode
BNodeType typeOfBNode(node vB) const
Definition: BCTree.h:545
ogdf::AdjElement
Class for adjacency list elements.
Definition: Graph_d.h:142
ogdf::BCTree::m_number
NodeArray< int > m_number
Temporary array.
Definition: BCTree.h:274
ogdf::BCTree::m_lowpt
NodeArray< int > m_lowpt
Temporary array.
Definition: BCTree.h:281
Minisat::Internal::copy
static void copy(const T &from, T &to)
Definition: Alg.h:61
ogdf::BCTree::m_bNode_type
NodeArray< BNodeType > m_bNode_type
Array that contains the type of each BC-tree-vertex.
Definition: BCTree.h:142
backward::details::move
const T & move(const T &v)
Definition: backward.hpp:243
SList.h
Declaration of singly linked lists and iterators.
ogdf::BCTree::m_B
Graph m_B
The BC-tree.
Definition: BCTree.h:88
ogdf::BCTree::m_hNode_bNode
NodeArray< node > m_hNode_bNode
Definition: BCTree.h:229
ogdf::BCTree::m_numC
int m_numC
The number of C-components.
Definition: BCTree.h:109
ogdf::operator<<
std::ostream & operator<<(std::ostream &os, const ogdf::Array< E, INDEX > &a)
Prints array a to output stream os.
Definition: Array.h:983
ogdf::List
Doubly linked lists (maintaining the length of the list).
Definition: DfsMakeBiconnected.h:40
ogdf::internal::GraphRegisteredArray
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition: Graph_d.h:658
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:869
ogdf::BCTree::m_gtoh
NodeArray< node > m_gtoh
Temporary array.
Definition: BCTree.h:297
ogdf::BCTree::m_gEdge_hEdge
EdgeArray< edge > m_gEdge_hEdge
A bijective mapping edges(G) -> edges(H).
Definition: BCTree.h:137
ogdf::BCTree::m_gNode_isMarked
NodeArray< bool > m_gNode_isMarked
Definition: BCTree.h:117
ogdf::BCTree::typeOfGNode
GNodeType typeOfGNode(node vG) const
Definition: BCTree.h:446
ogdf::BCTree::m_hEdge_bNode
EdgeArray< node > m_hEdge_bNode
A surjective mapping edges(H) -> vertices(B).
Definition: BCTree.h:238
ogdf::BCTree::rep
node rep(node vG) const
Returns a vertex of the biconnected components graph corresponding to a given vertex of the original ...
Definition: BCTree.h:509
ogdf::BCTree::BCTree
BCTree(Graph &G, node vG, bool not_connected=false)
A constructor.
Definition: BCTree.h:389
ogdf::BCTree::~BCTree
virtual ~BCTree()
Virtual destructor.
Definition: BCTree.h:413
ogdf::graphics::init
void init()
Definition: graphics.h:450
ogdf::BCTree::numberOfEdges
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:566
basic.h
Basic declarations, included by all source files.
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
ogdf::BCTree::m_G
Graph & m_G
The original graph.
Definition: BCTree.h:80
ogdf::BCTree::hEdges
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:557
ogdf::BCTree::numberOfNodes
int numberOfNodes(node vB) const
Returns the number of vertices belonging to the biconnected component represented by a given BC-tree-...
Definition: BCTree.h:576
ogdf::BCTree::original
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:535
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:363
ogdf::BCTree::m_bNode_isMarked
NodeArray< bool > m_bNode_isMarked
Array of marks for the BC-tree-vertices.
Definition: BCTree.h:150
ogdf::BCTree::m_bNode_numNodes
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:218
ogdf::BCTree::BNodeType
BNodeType
Enumeration type for characterizing the BC-tree-vertices.
Definition: BCTree.h:71
ogdf::BCTree::originalGraph
const Graph & originalGraph() const
Returns the original graph.
Definition: BCTree.h:422
ogdf::BCTree::m_numB
int m_numB
The number of B-components.
Definition: BCTree.h:106
ogdf::BCTree::m_eStack
ArrayBuffer< adjEntry > m_eStack
Temporary stack.
Definition: BCTree.h:289
ogdf::BCTree::m_nodes
SList< node > m_nodes
Temporary list.
Definition: BCTree.h:305
ogdf::BCTree::bccomp
virtual node bccomp(edge eH) const
Returns the BC-tree-vertex representing the biconnected component which a given edge of the auxiliary...
Definition: BCTree.h:496
ogdf::BCTree::m_H
Graph m_H
The biconnected components graph.
Definition: BCTree.h:102
ogdf::BCTree::bccomp
virtual node bccomp(node vH) const
Returns a BC-tree-vertex representing a biconnected component which a given vertex of the auxiliary g...
Definition: BCTree.h:487
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:240
ogdf::BCTree::BCTree
BCTree(Graph &G, bool not_connected=false)
A constructor.
Definition: BCTree.h:378
ogdf::internal::EdgeArrayBase2
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition: Graph_d.h:716