Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

EmbedderBCTreeBase.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/Graph.h>
35 #include <ogdf/basic/GraphList.h>
36 #include <ogdf/basic/basic.h>
41 
42 #include <type_traits>
43 
44 namespace ogdf {
45 namespace embedder {
46 
48 template<bool EnableLayers, bool IsEmbedderMinDepth = false>
50  using BicompEmbedder = typename std::conditional<EnableLayers,
52 
53 protected:
55  BCTree* pBCTree = nullptr;
56 
58  adjEntry* pAdjExternal = nullptr;
59 
62  virtual adjEntry trivialInit(Graph& G) {
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) {
81  *pAdjExternal = trivialInit(G);
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 }
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
Static BC-trees.
Definition: BCTree.h:60
Graph.h
Includes declaration of graph class.
OGDF_ASSERT
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition: basic.h:66
ogdf::EmbedderMaxFaceBiconnectedGraphs
Embedder that maximizing the external face.
Definition: EmbedderMaxFaceBiconnectedGraphs.h:54
ogdf::embedder::EmbedderBCTreeBase
Common base for embedder algorithms based on BC trees.
Definition: EmbedderBCTreeBase.h:49
ogdf::EmbedderMaxFaceBiconnectedGraphsLayers
Embedder that maximizes the external face (plus layers approach).
Definition: EmbedderMaxFaceBiconnectedGraphsLayers.h:63
ogdf::AdjElement::twin
adjEntry twin() const
Returns the corresponding adjacency element associated with the same edge.
Definition: Graph_d.h:172
ogdf::AdjElement
Class for adjacency list elements.
Definition: Graph_d.h:142
ogdf::embedder::EmbedderBCTreeBase::initBCTree
node initBCTree(Graph &G)
Initializes pBCTree and returns the root node of this tree or nullptr if G is biconnected.
Definition: EmbedderBCTreeBase.h:73
BCTree.h
Declaration of class BCTree.
ogdf::Graph::nodes
internal::GraphObjectContainer< NodeElement > nodes
The container containing all node objects.
Definition: Graph_d.h:932
ogdf::Graph::numberOfNodes
int numberOfNodes() const
Returns the number of nodes in the graph.
Definition: Graph_d.h:982
backward::Color::type
type
Definition: backward.hpp:1716
GraphList.h
Decralation of GraphElement and GraphList classes.
ogdf::embedder::EmbedderBCTreeBase::BicompEmbedder
typename std::conditional< EnableLayers, EmbedderMaxFaceBiconnectedGraphsLayers< int >, EmbedderMaxFaceBiconnectedGraphs< int > >::type BicompEmbedder
Definition: EmbedderBCTreeBase.h:51
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
EmbedderMaxFaceBiconnectedGraphsLayers.h
Computes an embedding of a biconnected graph with maximum external face.
ogdf::EmbedderModule
Base class for embedder algorithms.
Definition: EmbedderModule.h:52
basic.h
Basic declarations, included by all source files.
EmbedderMaxFaceBiconnectedGraphs.h
Declares ogdf::EmbedderMaxFaceBiconnectedGraphs.
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
EmbedderModule.h
Defines ogdf::EmbedderModule.
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:240
ogdf::internal::EdgeArrayBase2
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition: Graph_d.h:716
ogdf::embedder::EmbedderBCTreeBase::trivialInit
virtual adjEntry trivialInit(Graph &G)
Initialization code for biconnected input. Returns an adjacency entry that lies on the external face.
Definition: EmbedderBCTreeBase.h:62