Open
Graph Drawing
Framework

 v. 2020.02 (Catalpa)
 

PlanarSubgraphBoyerMyrvold.h
Go to the documentation of this file.
1 
33 #pragma once
34 
35 #include <random>
40 
41 namespace ogdf {
42 
44 
51 {
52 private:
53  int m_runs;
54  double m_randomness;
56  std::minstd_rand m_rand;
57 
58 public:
68  explicit PlanarSubgraphBoyerMyrvold(int runs = 1, double randomness = 0) :
69  m_runs(runs),
70  m_randomness(randomness),
71  m_rand(rand())
72  {};
73 
75 
76  virtual PlanarSubgraphBoyerMyrvold *clone() const override {
77  return new PlanarSubgraphBoyerMyrvold(m_runs);
78  };
79 
83  void seed(std::minstd_rand rand) {
84  m_rand = rand;
85  }
86 
87 protected:
97  virtual ReturnType doCall(
98  const Graph &graph,
99  const List<edge> &preferedEdges,
100  List<edge> &delEdges,
101  const EdgeArray<int> *pCost,
102  bool preferedImplyPlanar) override;
103 
107  bool isRemoved(const GraphCopy &copy, const edge e) {
108  return copy.copy(e) == nullptr || copy.copy(e)->source() != copy.copy(e->source()) || copy.copy(e)->target() != copy.copy(e->target());
109  }
110 };
111 
112 }
void seed(std::minstd_rand rand)
Seeds the random generator for performing a random DFS. If this method is never called the random gen...
node target() const
Returns the target node of the edge.
Definition: Graph_d.h:328
node copy(node v) const
Returns the node in the graph copy corresponding to v.
Definition: GraphCopy.h:335
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
PlanarSubgraphBoyerMyrvold(int runs=1, double randomness=0)
Creates a new Boyer-Myrvold subgraph module.
ReturnType
The return type of a module.
Definition: Module.h:51
Interface for planar subgraph algorithms.
static void copy(const T &from, T &to)
Definition: Alg.h:61
bool isRemoved(const GraphCopy &copy, const edge e)
Returns true iff this edge could not be embedded.
Class for the representation of edges.
Definition: Graph_d.h:292
Copies of graphs supporting edge splitting.
Definition: GraphCopy.h:249
Declaration of the wrapper class of the Boyer-Myrvold planarity test.
Declaration of the class BoyerMyrvoldPlanar.
Booth-Lueker planarity test.
Definition: BoothLueker.h:51
node source() const
Returns the source node of the edge.
Definition: Graph_d.h:326
The namespace for all OGDF objects.
virtual PlanarSubgraphBoyerMyrvold * clone() const override
Returns a new instance of the planar subgraph module with the same option settings.
Declaration of interface for planar subgraph algorithms.
Maximum planar subgraph heuristic based on the Boyer-Myrvold planarity test.
Declaration of BoothLueker which implements a planarity test and planar embedding algorithm...