46template<
typename TCost,
class Enable =
void>
47class MaximalPlanarSubgraphSimple { };
59template<
typename TCost>
76 if (m_deleteHeuristic) {
82 virtual MaximalPlanarSubgraphSimple*
clone()
const override {
83 auto result =
new MaximalPlanarSubgraphSimple(*(m_heuristic.clone()));
84 result->m_deleteHeuristic =
104 if (
pCost ==
nullptr) {
111 if (Module::isSolution(result)) {
134template<
typename TCost>
146 , m_deleteHeuristic(
true)
148 , m_randomGenerator()
158 double randomness = 0.0,
unsigned int runs = 1)
160 , m_deleteHeuristic(
false)
162 , m_randomGenerator()
169 if (m_deleteHeuristic) {
175 virtual MaximalPlanarSubgraphSimple*
clone()
const override {
176 auto result =
new MaximalPlanarSubgraphSimple(*(m_heuristic.clone()), m_randomness, m_runs);
177 result->m_deleteHeuristic =
186 void setSeed(
unsigned seed) { m_randomGenerator.seed(seed); }
210 for (
auto i = 0u; i < m_runs; i++) {
213 if (
pCost ==
nullptr) {
216 std::uniform_real_distribution<TCost>
distribution(0.0, 1.0);
218 TCost maxCost = firstEdge ==
nullptr ? 0 : (*pCost)[firstEdge];
219 TCost minCost = firstEdge ==
nullptr ? 0 : (*pCost)[firstEdge];
239 if (Module::isSolution(result)) {
242 if (
pCost !=
nullptr) {
261 if (
pCost ==
nullptr) {
300 for (
auto e : list) {
Implementation of disjoint sets data structures (union-find functionality).
Declaration and Implementation of class PlanarSubgraphEmpty.
Dynamic arrays indexed with edges.
Class for the representation of edges.
Copies of graphs supporting edge splitting.
virtual void delEdge(edge e) override
Removes edge e and clears the list of edges corresponding to e's original edge.
node copy(node v) const
Returns the node in the graph copy corresponding to v.
edge newEdge(edge eOrig)
Creates a new edge (v,w) with original edge eOrig.
Data type for general directed graphs (adjacency list representation).
edge firstEdge() const
Returns the first edge in the list of all edges.
internal::GraphObjectContainer< EdgeElement > edges
The container containing all edge objects.
Doubly linked lists (maintaining the length of the list).
int size() const
Returns the number of elements in the list.
void clear()
Removes all elements from the list.
iterator pushBack(const E &x)
Adds element x at the end of the list.
void quicksort()
Sorts the list using Quicksort.
virtual ~MaximalPlanarSubgraphSimple()
Desctructor.
PlanarSubgraphModule< TCost > & m_heuristic
user given heuristic
virtual MaximalPlanarSubgraphSimple * clone() const override
Clone method.
MaximalPlanarSubgraphSimple()
Constructor.
bool m_deleteHeuristic
flag to store we have to delete a self created heuristic
MaximalPlanarSubgraphSimple(PlanarSubgraphModule< TCost > &heuristic)
Constructor with user given heuristic that is executed before extending the solution to maximality.
virtual Module::ReturnType doCall(const Graph &graph, const List< edge > &preferredEdges, List< edge > &delEdges, const EdgeArray< TCost > *pCost, bool preferredImplyPlanar) override
Computes the set of edges delEdges which have to be deleted to obtain the planar subgraph.
MaximalPlanarSubgraphSimple(PlanarSubgraphModule< TCost > &heuristic, double randomness=0.0, unsigned int runs=1)
Constructor.
TCost weightOfList(const List< edge > &list, const EdgeArray< TCost > &weights)
void setSeed(unsigned seed)
set seed of std::default_random_engine generator to use when randomness > 0
bool m_deleteHeuristic
flag to store we have to delete a self created heuristic
std::default_random_engine m_randomGenerator
random generator to use with std::uniform_real_distribution
unsigned int m_runs
number of runs when algorithms is randomized
virtual Module::ReturnType doCall(const Graph &graph, const List< edge > &preferredEdges, List< edge > &delEdges, const EdgeArray< TCost > *pCost, bool preferredImplyPlanar) override
Computes the set of edges delEdges which have to be deleted to obtain the planar subgraph.
virtual ~MaximalPlanarSubgraphSimple()
Destructor.
PlanarSubgraphModule< TCost > & m_heuristic
user given heuristic
virtual MaximalPlanarSubgraphSimple * clone() const override
Clone method.
double m_randomness
randomness of the process: use 0 to compute everything based on the costs, use 1 for completely rando...
MaximalPlanarSubgraphSimple()
Constructor.
ReturnType
The return type of a module.
Dummy implementation for maximum planar subgraph that returns an empty graph.
Interface for planar subgraph algorithms.
Declaration of extended graph algorithms.
bool isPlanar(const Graph &G)
Returns true, if G is planar, false otherwise.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.
Declaration of simple graph algorithms.
Compare elements based on a single comparable attribute.