Open
Graph Drawing
Framework

 v. 2020.02 (Catalpa)
 

EmbedderModule.h
Go to the documentation of this file.
1 
32 #pragma once
33 
35 #include <ogdf/basic/Module.h>
36 #include <ogdf/basic/Timeouter.h>
37 
38 namespace ogdf {
39 
49 class OGDF_EXPORT EmbedderModule : public Module, public Timeouter {
50 public:
53 
54  virtual ~EmbedderModule() { }
55 
63  void call(Graph& G, adjEntry& adjExternal) {
64  if (G.numberOfNodes() > 1 && G.numberOfEdges() > 1) {
66  doCall(G, adjExternal);
67  } else if (G.numberOfEdges() == 1) {
68  adjExternal = G.firstEdge()->adjSource();
69  }
70  };
71 
73  void operator()(Graph& G, adjEntry& adjExternal) { call(G, adjExternal); }
74 
76 protected:
77 
83  virtual void doCall(Graph& G, adjEntry& adjExternal) = 0;
84 };
85 
86 }
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
adjEntry adjSource() const
Returns the corresponding adjacancy entry at source node.
Definition: Graph_d.h:333
#define OGDF_MALLOC_NEW_DELETE
Makes the class use malloc for memory allocation.
Definition: memory.h:91
Declares base class for all module types.
Base class for modules.
Definition: Module.h:47
int numberOfEdges() const
Returns the number of edges in the graph.
Definition: Graph_d.h:601
class for timeout funtionality.
Definition: Timeouter.h:47
edge firstEdge() const
Returns the first edge in the list of all edges.
Definition: Graph_d.h:623
bool isPlanar(const Graph &G)
Returns true, if G is planar, false otherwise.
void call(Graph &G, adjEntry &adjExternal)
Calls the embedder algorithm for graph G.
void operator()(Graph &G, adjEntry &adjExternal)
Calls the embedder algorithm for graph G.
Declares base class for modules with timeout functionality.
The namespace for all OGDF objects.
Declaration of extended graph algorithms.
Base class for embedder algorithms.
int numberOfNodes() const
Returns the number of nodes in the graph.
Definition: Graph_d.h:598
EmbedderModule()
Initializes an embedder module.
Class for adjacency list elements.
Definition: Graph_d.h:79
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition: basic.h:41