Open
Graph Drawing
Framework

 v. 2020.02 (Catalpa)
 

EmbedderBCTreeBase.h
Go to the documentation of this file.
1 
32 #pragma once
33 
38 
39 namespace ogdf {
40 namespace embedder {
41 
43 template<bool EnableLayers>
45  using BicompEmbedder = typename std::conditional<EnableLayers, EmbedderMaxFaceBiconnectedGraphsLayers<int>, EmbedderMaxFaceBiconnectedGraphs<int>>::type;
46 protected:
48  BCTree* pBCTree = nullptr;
49 
51  adjEntry* pAdjExternal = nullptr;
52 
55  virtual adjEntry trivialInit(Graph &G) {
56  NodeArray<int> m_nodeLength(G, 0);
57  EdgeArray<int> m_edgeLength(G, 0);
58  adjEntry m_adjExternal;
59  BicompEmbedder::embed(G, m_adjExternal, m_nodeLength, m_edgeLength);
60 
61  return m_adjExternal->twin();
62  }
63 
67  node result = nullptr;
68 
69  // HINT: Edges are directed from child to parent in BC-trees
70  pBCTree = new BCTree(G);
71 
72  // base case of biconnected graph
73  if (pBCTree->bcTree().numberOfNodes() == 1) {
74  *pAdjExternal = trivialInit(G);
75  delete pBCTree;
76  } else {
77  // Find root Block (only node with out-degree of 0):
78  for (node v : pBCTree->bcTree().nodes) {
79  if (v->outdeg() == 0) {
80  result = v;
81  break;
82  }
83  }
84 
85  OGDF_ASSERT(result != nullptr);
86  }
87 
88  return result;
89  }
90 };
91 
92 }}
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:492
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:99
Defines ogdf::EmbedderModule.
Declaration of class BCTree.
virtual adjEntry trivialInit(Graph &G)
Initialization code for biconnected input. Returns an adjacency entry that lies on the external face...
typename std::conditional< EnableLayers, EmbedderMaxFaceBiconnectedGraphsLayers< int >, EmbedderMaxFaceBiconnectedGraphs< int > >::type BicompEmbedder
Static BC-trees.
Definition: BCTree.h:55
adjEntry twin() const
Returns the corresponding adjacency element associated with the same edge.
Definition: Graph_d.h:105
Class for the representation of nodes.
Definition: Graph_d.h:169
node initBCTree(Graph &G)
Initializes pBCTree and returns the root node of this tree or nullptr if G is biconnected.
Declares ogdf::EmbedderMaxFaceBiconnectedGraphs.
Computes an embedding of a biconnected graph with maximum external face.
Common base for embedder algorithms based on BC trees.
Embedder that maximizing the external face.
The namespace for all OGDF objects.
Base class for embedder algorithms.
int numberOfNodes() const
Returns the number of nodes in the graph.
Definition: Graph_d.h:598
internal::GraphObjectContainer< NodeElement > nodes
The container containing all node objects.
Definition: Graph_d.h:565
Class for adjacency list elements.
Definition: Graph_d.h:79
const Graph & bcTree() const
Returns the BC-tree graph.
Definition: BCTree.h:392
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition: basic.h:41