Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
EmbedderBCTreeBase.h
Go to the documentation of this file.
1
32#pragma once
33
34#include <ogdf/basic/Graph.h>
36#include <ogdf/basic/basic.h>
41
42#include <type_traits>
43
44namespace ogdf {
45namespace embedder {
46
48template<bool EnableLayers, bool IsEmbedderMinDepth = false>
50 using BicompEmbedder = typename std::conditional<EnableLayers,
52
53protected:
55 BCTree* pBCTree = nullptr;
56
59
63 NodeArray<int> m_nodeLength(G, 0);
64 EdgeArray<int> m_edgeLength(G, IsEmbedderMinDepth ? 0 : 1);
65 adjEntry m_adjExternal;
66 BicompEmbedder::embed(G, m_adjExternal, m_nodeLength, m_edgeLength);
67
68 return m_adjExternal->twin();
69 }
70
74 node result = nullptr;
75
76 // HINT: Edges are directed from child to parent in BC-trees
77 pBCTree = new BCTree(G);
78
79 // base case of biconnected graph
80 if (pBCTree->bcTree().numberOfNodes() == 1) {
82 delete pBCTree;
83 } else {
84 // Find root Block (only node with out-degree of 0):
85 for (node v : pBCTree->bcTree().nodes) {
86 if (v->outdeg() == 0) {
87 result = v;
88 break;
89 }
90 }
91
92 OGDF_ASSERT(result != nullptr);
93 }
94
95 return result;
96 }
97};
98
99}
100}
Declaration of class BCTree.
Declares ogdf::EmbedderMaxFaceBiconnectedGraphs.
Computes an embedding of a biconnected graph with maximum external face.
Defines ogdf::EmbedderModule.
Includes declaration of graph class.
Decralation of GraphElement and GraphList classes.
Basic declarations, included by all source files.
Class for adjacency list elements.
Definition Graph_d.h:143
Static BC-trees.
Definition BCTree.h:60
const Graph & bcTree() const
Returns the BC-tree graph.
Definition BCTree.h:425
Embedder that maximizing the external face.
Embedder that maximizes the external face (plus layers approach).
Base class for embedder algorithms.
Data type for general directed graphs (adjacency list representation).
Definition Graph_d.h:866
int numberOfNodes() const
Returns the number of nodes in the graph.
Definition Graph_d.h:979
internal::GraphObjectContainer< NodeElement > nodes
The container containing all node objects.
Definition Graph_d.h:929
Class for the representation of nodes.
Definition Graph_d.h:241
Common base for embedder algorithms based on BC trees.
BCTree * pBCTree
BC-tree of the original graph.
adjEntry * pAdjExternal
an adjacency entry on the external face
virtual adjEntry trivialInit(Graph &G)
Initialization code for biconnected input. Returns an adjacency entry that lies on the external face.
node initBCTree(Graph &G)
Initializes pBCTree and returns the root node of this tree or nullptr if G is biconnected.
typename std::conditional< EnableLayers, EmbedderMaxFaceBiconnectedGraphsLayers< int >, EmbedderMaxFaceBiconnectedGraphs< int > >::type BicompEmbedder
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition Graph_d.h:717
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition Graph_d.h:659
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition basic.h:52
The namespace for all OGDF objects.