Computation of a planar subgraph using PQ-trees. More...
#include <ogdf/planarity/PlanarSubgraphFast.h>
Classes | |
class | ThreadMaster |
class | Worker |
Public Member Functions | |
PlanarSubgraphFast () | |
Creates an instance of the fast planar subgraph algorithm with default settings (runs = 10). | |
virtual PlanarSubgraphFast * | clone () const override |
Returns a new instance of fast planar subgraph with the same option settings. | |
int | runs () const |
Returns the current number of randomized runs. | |
void | runs (int nRuns) |
Sets the number of randomized runs to nRuns . | |
Public Member Functions inherited from ogdf::PlanarSubgraphModule< TCost > | |
PlanarSubgraphModule () | |
Initializes a planar subgraph module (default constructor). | |
ReturnType | call (const Graph &G, const EdgeArray< TCost > &cost, const List< edge > &preferredEdges, List< edge > &delEdges, bool preferredImplyPlanar=false) |
Returns the set of edges delEdges which have to be deleted to obtain the planar subgraph. | |
ReturnType | call (const Graph &G, const EdgeArray< TCost > &cost, List< edge > &delEdges) |
Returns the set of edges delEdges which have to be deleted to obtain the planar subgraph. | |
ReturnType | call (const Graph &G, const List< edge > &preferredEdges, List< edge > &delEdges, bool preferredImplyPlanar=false) |
Returns the set of edges delEdges which have to be deleted to obtain the planar subgraph. | |
ReturnType | call (const Graph &G, List< edge > &delEdges) |
Returns the set of edges delEdges which have to be deleted to obtain the planar subgraph. | |
ReturnType | callAndDelete (GraphCopy &GC, const List< edge > &preferredEdges, List< edge > &delOrigEdges, bool preferredImplyPlanar=false) |
Makes GC planar by deleting edges. | |
ReturnType | callAndDelete (GraphCopy &GC, List< edge > &delOrigEdges) |
Makes G planar by deleting edges. | |
unsigned int | maxThreads () const |
Returns the maximal number of used threads. | |
void | maxThreads (unsigned int n) |
Sets the maximal number of used threads to n . | |
ReturnType | operator() (const Graph &G, const List< edge > &preferredEdges, List< edge > &delEdges, bool preferredImplyPlanar=false) |
Returns the set of edges delEdges which have to be deleted to obtain the planar subgraph. | |
ReturnType | operator() (const Graph &G, List< edge > &delEdges) |
Returns the set of edges delEdges which have to be deleted to obtain the planar subgraph. | |
Public Member Functions inherited from ogdf::Module | |
Module () | |
Initializes a module. | |
virtual | ~Module () |
Public Member Functions inherited from ogdf::Timeouter | |
Timeouter () | |
timeout is turned of by default | |
Timeouter (bool t) | |
timeout is turned off (false) or on (true) (with 0 second) | |
Timeouter (const Timeouter &t) | |
Timeouter (double t) | |
timeout is set to the given value (seconds) | |
~Timeouter () | |
bool | isTimeLimit () const |
returns whether any time limit is set or not | |
Timeouter & | operator= (const Timeouter &t) |
double | timeLimit () const |
returns the current time limit for the call | |
void | timeLimit (bool t) |
shorthand to turn timelimit off or on (with 0 seconds) | |
void | timeLimit (double t) |
sets the time limit for the call (in seconds); <0 means no limit. | |
Protected Member Functions | |
virtual Module::ReturnType | doCall (const Graph &G, const List< edge > &preferedEdges, List< edge > &delEdges, const EdgeArray< TCost > *pCost, bool preferedImplyPlanar) override |
Returns true, if G is planar, false otherwise. | |
Private Types | |
using | BlockType = std::pair< Graph *, EdgeArray< edge > * > |
Private Member Functions | |
void | parCall (const Array< BlockType > &block, const EdgeArray< TCost > *pCost, int nRuns, unsigned int nThreads, List< edge > &delEdges) |
Realizes the parallel implementation. | |
void | seqCall (const Array< BlockType > &block, const EdgeArray< TCost > *pCost, int nRuns, bool randomize, List< edge > &delEdges) |
Realizes the sequential implementation. | |
Static Private Member Functions | |
static void | doWorkHelper (ThreadMaster &master) |
static void | planarize (const Graph &G, NodeArray< int > &numbering, List< edge > &delEdges) |
Performs a planarization on a biconnected component of G . | |
Private Attributes | |
int | m_nRuns |
The number of runs for randomization. | |
Additional Inherited Members | |
Public Types inherited from ogdf::Module | |
enum class | ReturnType { Feasible , Optimal , NoFeasibleSolution , TimeoutFeasible , TimeoutInfeasible , Error } |
The return type of a module. More... | |
Static Public Member Functions inherited from ogdf::Module | |
static bool | isSolution (ReturnType ret) |
Returns true iff ret indicates that the module returned a feasible solution. | |
Protected Attributes inherited from ogdf::Timeouter | |
double | m_timeLimit |
Time limit for module calls (< 0 means no limit). | |
Computation of a planar subgraph using PQ-trees.
Literature: Jayakumar, Thulasiraman, Swamy 1989
Option | Type | Default | Description |
---|---|---|---|
runs | int | 0 | the number of randomized runs performed by the algorithm; the best solution is picked among all the runs. If runs is 0, one deterministic run is performed. |
Observe that this algorithm by theory does not compute a maximal planar subgraph. It is however the fastest known good heuristic.
Definition at line 69 of file PlanarSubgraphFast.h.
Definition at line 70 of file PlanarSubgraphFast.h.
|
inline |
Creates an instance of the fast planar subgraph algorithm with default settings (runs = 10).
Definition at line 157 of file PlanarSubgraphFast.h.
|
inlineoverridevirtual |
Returns a new instance of fast planar subgraph with the same option settings.
Implements ogdf::PlanarSubgraphModule< TCost >.
Definition at line 160 of file PlanarSubgraphFast.h.
|
inlineoverrideprotectedvirtual |
Returns true, if G is planar, false otherwise.
Implements ogdf::PlanarSubgraphModule< TCost >.
Definition at line 178 of file PlanarSubgraphFast.h.
|
inlinestaticprivate |
Definition at line 392 of file PlanarSubgraphFast.h.
|
inlineprivate |
Realizes the parallel implementation.
Definition at line 315 of file PlanarSubgraphFast.h.
|
inlinestaticprivate |
Performs a planarization on a biconnected component of G
.
The numbering contains an st-numbering of the component.
Definition at line 339 of file PlanarSubgraphFast.h.
|
inline |
Returns the current number of randomized runs.
Definition at line 170 of file PlanarSubgraphFast.h.
Sets the number of randomized runs to nRuns
.
Definition at line 167 of file PlanarSubgraphFast.h.
|
inlineprivate |
Realizes the sequential implementation.
Definition at line 256 of file PlanarSubgraphFast.h.
|
private |
The number of runs for randomization.
Definition at line 253 of file PlanarSubgraphFast.h.