Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

PlanarSubgraphBoyerMyrvold.h
Go to the documentation of this file.
1 
33 #pragma once
34 
35 #include <ogdf/basic/Graph.h>
36 #include <ogdf/basic/GraphCopy.h>
37 #include <ogdf/basic/basic.h>
40 
41 #include <cstdlib>
42 #include <random>
43 
44 namespace ogdf {
45 template<class E>
46 class List;
47 
49 
56 private:
57  int m_runs;
58  double m_randomness;
60  std::minstd_rand m_rand;
61 
62 public:
72  explicit PlanarSubgraphBoyerMyrvold(int runs = 1, double randomness = 0)
73  : m_runs(runs), m_randomness(randomness), m_rand(rand()) {};
74 
76 
77  virtual PlanarSubgraphBoyerMyrvold* clone() const override {
78  return new PlanarSubgraphBoyerMyrvold(m_runs);
79  };
80 
84  void seed(std::minstd_rand rand) { m_rand = rand; }
85 
86 protected:
96  virtual ReturnType doCall(const Graph& graph, const List<edge>& preferedEdges,
97  List<edge>& delEdges, const EdgeArray<int>* pCost, bool preferedImplyPlanar) override;
98 
102  bool isRemoved(const GraphCopy& copy, const edge e) {
103  return copy.copy(e) == nullptr || copy.copy(e)->source() != copy.copy(e->source())
104  || copy.copy(e)->target() != copy.copy(e->target());
105  }
106 };
107 
108 }
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
ogdf::PlanarSubgraphBoyerMyrvold::~PlanarSubgraphBoyerMyrvold
~PlanarSubgraphBoyerMyrvold()
Definition: PlanarSubgraphBoyerMyrvold.h:75
ogdf::PlanarSubgraphModule
Interface for planar subgraph algorithms.
Definition: PlanarSubgraphModule.h:53
Graph.h
Includes declaration of graph class.
ogdf::BoothLueker
Booth-Lueker planarity test.
Definition: BoothLueker.h:52
ogdf::PlanarSubgraphBoyerMyrvold::seed
void seed(std::minstd_rand rand)
Seeds the random generator for performing a random DFS. If this method is never called the random gen...
Definition: PlanarSubgraphBoyerMyrvold.h:84
ogdf::GraphCopy
Copies of graphs supporting edge splitting.
Definition: GraphCopy.h:391
ogdf::PlanarSubgraphBoyerMyrvold::m_planModule
BoothLueker m_planModule
Definition: PlanarSubgraphBoyerMyrvold.h:59
ogdf::PlanarSubgraphBoyerMyrvold::isRemoved
bool isRemoved(const GraphCopy &copy, const edge e)
Returns true iff this edge could not be embedded.
Definition: PlanarSubgraphBoyerMyrvold.h:102
Minisat::Internal::copy
static void copy(const T &from, T &to)
Definition: Alg.h:61
PlanarSubgraphModule.h
Declaration of interface for planar subgraph algorithms.
ogdf::EdgeElement::source
node source() const
Returns the source node of the edge.
Definition: Graph_d.h:398
GraphCopy.h
Declaration of graph copy classes.
ogdf::List< edge >
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:869
ogdf::PlanarSubgraphBoyerMyrvold::m_rand
std::minstd_rand m_rand
Definition: PlanarSubgraphBoyerMyrvold.h:60
ogdf::PlanarSubgraphBoyerMyrvold::m_runs
int m_runs
Definition: PlanarSubgraphBoyerMyrvold.h:57
basic.h
Basic declarations, included by all source files.
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:363
BoothLueker.h
Declaration of BoothLueker which implements a planarity test and planar embedding algorithm.
ogdf::PlanarSubgraphBoyerMyrvold
Maximum planar subgraph heuristic based on the Boyer-Myrvold planarity test.
Definition: PlanarSubgraphBoyerMyrvold.h:55
ogdf::PlanarSubgraphBoyerMyrvold::PlanarSubgraphBoyerMyrvold
PlanarSubgraphBoyerMyrvold(int runs=1, double randomness=0)
Creates a new Boyer-Myrvold subgraph module.
Definition: PlanarSubgraphBoyerMyrvold.h:72
ogdf::EdgeElement::target
node target() const
Returns the target node of the edge.
Definition: Graph_d.h:401
ogdf::PlanarSubgraphBoyerMyrvold::m_randomness
double m_randomness
Definition: PlanarSubgraphBoyerMyrvold.h:58
ogdf::PlanarSubgraphBoyerMyrvold::clone
virtual PlanarSubgraphBoyerMyrvold * clone() const override
Definition: PlanarSubgraphBoyerMyrvold.h:77
ogdf::internal::EdgeArrayBase2
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition: Graph_d.h:716