Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
BCTree.h
Go to the documentation of this file.
1
32#pragma once
33
36#include <ogdf/basic/SList.h>
37
38namespace ogdf {
39
56public:
58 enum class GNodeType {
60 Normal,
62 CutVertex
63 };
64
66 enum class BNodeType {
68 BComp,
70 CComp
71 };
72
73protected:
76
84
97 mutable Graph m_H;
98
102
106
113
125
134
138
146
166
187
201
215
225
234
243
253
261
277
285
293
301
310 void init(node vG);
312
322
333
343
351 virtual node parent(node vB) const;
352
361
363
364public:
373 explicit BCTree(Graph& G, bool callInitConnected = false)
374 : m_G(G), m_eStack(G.numberOfEdges()) {
375 if (!callInitConnected) {
376 init(G.firstNode());
377 } else {
378 initNotConnected(G.firstNode());
379 }
380 }
381
391 : m_G(G), m_eStack(G.numberOfEdges()) {
392 if (!callInitConnected) {
393 init(vG);
394 } else {
395 initNotConnected(vG);
396 }
397 }
398
409 BCTree(Graph& G, List<node>& vG) : m_G(G), m_eStack(G.numberOfEdges()) { initNotConnected(vG); }
410
412 virtual ~BCTree() { }
413
416 const Graph& originalGraph() const { return m_G; }
417
419 const Graph& bcTree() const { return m_B; }
420
422 const Graph& auxiliaryGraph() const { return m_H; }
423
425
428 int numberOfBComps() const { return m_numB; }
429
431 int numberOfCComps() const { return m_numC; }
432
434
441 return m_bNode_type[m_hNode_bNode[m_gNode_hNode[vG]]] == BNodeType::BComp
442 ? GNodeType::Normal
443 : GNodeType::CutVertex;
444 }
445
458 virtual node bcproper(node vG) const { return m_hNode_bNode[m_gNode_hNode[vG]]; }
459
467 virtual node bcproper(edge eG) const { return m_hEdge_bNode[m_gEdge_hEdge[eG]]; }
468
480 node rep(node vG) const { return m_gNode_hNode[vG]; }
481
488 edge rep(edge eG) const { return m_gEdge_hEdge[eG]; }
489
491
498 node original(node vH) { return m_hNode_gNode[vH]; }
499
506 edge original(edge eH) const { return m_hEdge_gEdge[eH]; }
507
509
516 BNodeType typeOfBNode(node vB) const { return m_bNode_type[vB]; }
517
528 const SList<edge>& hEdges(node vB) const { return m_bNode_hEdges[vB]; }
529
537 int numberOfEdges(node vB) const { return m_bNode_hEdges[vB].size(); }
538
547 int numberOfNodes(node vB) const { return m_bNode_numNodes[vB]; }
548
550
563
574
585
599 virtual node repVertex(node uG, node vB) const;
600
630 virtual node cutVertex(node uB, node vB) const;
631
633private:
635 BCTree(const BCTree&) = delete;
636
638 BCTree& operator=(const BCTree&) = delete;
639
641 void initEdges();
642};
643
644}
Declaration and implementation of EdgeArray class.
Declaration and implementation of NodeArray class.
Declaration of singly linked lists and iterators.
Class for adjacency list elements.
Definition Graph_d.h:79
An array that keeps track of the number of inserted elements; also usable as an efficient stack.
Definition ArrayBuffer.h:56
INDEX size() const
Returns the size (number of elements) of the array.
Definition Array.h:297
Static BC-trees.
Definition BCTree.h:55
BNodeType
Enumeration type for characterizing the BC-tree-vertices.
Definition BCTree.h:66
void initNotConnected(node vG)
Initialization for not connected graphs.
void initEdges()
NodeArray< bool > m_bNode_isMarked
Array of marks for the BC-tree-vertices.
Definition BCTree.h:145
GNodeType
Enumeration type for characterizing the vertices of the original graph.
Definition BCTree.h:58
int m_numC
The number of C-components.
Definition BCTree.h:104
node rep(node vG) const
Returns a vertex of the biconnected components graph corresponding to a given vertex of the original ...
Definition BCTree.h:480
void init(node vG)
void biComp(adjEntry adjuG, node vG)
Generates the BC-tree and the biconnected components graph recursively.
SList< node > * findPathBCTree(node sB, node tB) const
Calculates a path in the BC-tree.
int numberOfNodes(node vB) const
Returns the number of vertices belonging to the biconnected component represented by a given BC-tree-...
Definition BCTree.h:547
ArrayBuffer< adjEntry > m_eStack
Temporary stack.
Definition BCTree.h:284
int m_numB
The number of B-components.
Definition BCTree.h:101
const Graph & bcTree() const
Returns the BC-tree graph.
Definition BCTree.h:419
int numberOfBComps() const
Returns the number of B-components.
Definition BCTree.h:428
Graph m_H
The biconnected components graph.
Definition BCTree.h:97
void initBasic(node vG)
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:200
virtual node parent(node vB) const
NodeArray< bool > m_gNode_isMarked
Definition BCTree.h:112
int m_count
Definition BCTree.h:260
Graph & m_G
The original graph.
Definition BCTree.h:75
virtual ~BCTree()
Virtual destructor.
Definition BCTree.h:412
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:528
const Graph & originalGraph() const
Returns the original graph.
Definition BCTree.h:416
node original(node vH)
Definition BCTree.h:498
NodeArray< node > m_gNode_hNode
An injective mapping vertices(G) -> vertices(H).
Definition BCTree.h:124
node findNCA(node uB, node vB) const
Calculates the nearest common ancestor of two vertices of the BC-tree.
void initNotConnected(List< node > &vG)
Initialization for not connected graphs.
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:458
BCTree(const BCTree &)=delete
Copy constructor is undefined!
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:488
NodeArray< node > m_hNode_bNode
Definition BCTree.h:224
EdgeArray< edge > m_gEdge_hEdge
A bijective mapping edges(G) -> edges(H).
Definition BCTree.h:132
EdgeArray< edge > m_hEdge_gEdge
A bijective mapping edges(H) -> edges(G).
Definition BCTree.h:251
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:213
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:537
NodeArray< node > m_hNode_gNode
A surjective mapping vertices(H) -> vertices(G).
Definition BCTree.h:242
const Graph & auxiliaryGraph() const
Returns the biconnected components graph.
Definition BCTree.h:422
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:186
NodeArray< int > m_number
Temporary array.
Definition BCTree.h:269
NodeArray< node > m_gtoh
Temporary array.
Definition BCTree.h:292
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:165
BCTree(Graph &G, List< node > &vG)
Constructor for not connected graphs.
Definition BCTree.h:409
EdgeArray< node > m_hEdge_bNode
A surjective mapping edges(H) -> vertices(B).
Definition BCTree.h:233
node bComponent(node uG, node vG) const
NodeArray< int > m_lowpt
Temporary array.
Definition BCTree.h:276
int numberOfCComps() const
Returns the number of C-components.
Definition BCTree.h:431
BCTree & operator=(const BCTree &)=delete
Assignment operator is undefined!
virtual node cutVertex(node uB, node vB) const
Returns the copy of a cut-vertex in the biconnected components graph which belongs to a certain B-com...
BCTree(Graph &G, node vG, bool callInitConnected=false)
A constructor.
Definition BCTree.h:390
SList< node > m_nodes
Temporary list.
Definition BCTree.h:300
GNodeType typeOfGNode(node vG) const
Definition BCTree.h:440
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:467
Graph m_B
The BC-tree.
Definition BCTree.h:83
NodeArray< BNodeType > m_bNode_type
Array that contains the type of each BC-tree-vertex.
Definition BCTree.h:137
SList< node > & findPath(node sG, node tG) const
Calculates a path in the BC-tree.
BCTree(Graph &G, bool callInitConnected=false)
A constructor.
Definition BCTree.h:373
BNodeType typeOfBNode(node vB) const
Definition BCTree.h:516
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:506
virtual node repVertex(node uG, node vB) const
Returns a vertex of the biconnected components graph corresponding to a given vertex of the original ...
Dynamic arrays indexed with edges.
Definition EdgeArray.h:125
Class for the representation of edges.
Definition Graph_d.h:300
Data type for general directed graphs (adjacency list representation).
Definition Graph_d.h:521
Doubly linked lists (maintaining the length of the list).
Definition List.h:1435
Dynamic arrays indexed with nodes.
Definition NodeArray.h:125
Class for the representation of nodes.
Definition Graph_d.h:177
Singly linked lists (maintaining the length of the list).
Definition SList.h:833
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition config.h:101
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.