The algorithm for planar biconnectivity augmentation (Mutzel, Fialko). More...
#include <ogdf/augmentation/PlanarAugmentation.h>
Public Member Functions | |
PlanarAugmentation () | |
Creates an instance of the planar augmentation algorithm. | |
~PlanarAugmentation () | |
Destruction. | |
Public Member Functions inherited from ogdf::AugmentationModule | |
AugmentationModule () | |
Initializes an augmentation module. | |
virtual | ~AugmentationModule () |
void | call (Graph &G) |
Calls the augmentation module for graph G . | |
void | call (Graph &G, List< edge > &L) |
Calls the augmentation module for graph G . | |
int | numberOfAddedEdges () const |
Returns the number of added edges. | |
void | operator() (Graph &G) |
Calls the augmentation module for graph G . | |
void | operator() (Graph &G, List< edge > &L) |
Calls the augmentation module for graph G . | |
Protected Member Functions | |
virtual void | doCall (Graph &G, List< edge > &list) override |
The implementation of the algorithm call. | |
Private Member Functions | |
void | addPendant (node pendant, pa_label &label) |
Adds pendant to label and updates the label-order. | |
node | adjToCutvertex (node v, node cutvertex=nullptr) |
Returns a node that belongs to bc-node v and is adjacent to cutvertex . | |
void | augment () |
The main function for planar augmentation. | |
bool | connectCondition (pa_label a, pa_label b) |
Checks if the pendants of label a and label b can be connected without creating a new pendant. | |
void | connectInsideLabel (pa_label &label) |
Connects the only pendant of label with a computed ancestor. | |
void | connectLabels (pa_label first, pa_label second) |
Inserts edges between pendants of label first and second . | |
edge | connectPendants (node pendant1, node pendant2) |
Connects two pendants. | |
void | deleteLabel (pa_label &label, bool removePendants=true) |
Deletes label . | |
void | deletePendant (node pendant, bool removeFromLabel=true) |
Deletes the pendant pendant , and, if removeFromLabel is true, removes it from the corresponding label and updates the label-order. | |
node | findLastBefore (node pendant, node ancestor) |
Traverses from pendant to ancestor and returns the last node before ancestor on the path. | |
bool | findMatching (pa_label &first, pa_label &second) |
Finds two matching labels, so all pendants can be connected without losing planarity. | |
PALabel::StopCause | followPath (node v, node &last) |
Traverses to the root and checks several stop conditions. | |
ListIterator< pa_label > | insertLabel (pa_label label) |
Inserts label into m_labels by decreasing order. | |
void | joinPendants (pa_label &label) |
Connects all pendants of label with new edges. | |
void | makeConnectedByPendants () |
Makes the graph connected by new edges between pendants of the connected components. | |
void | modifyBCRoot (node oldRoot, node newRoot) |
Modifies the root of the BC-Tree that newRoot replaces oldRoot . | |
pa_label | newLabel (node cutvertex, node pendant, PALabel::StopCause whyStop) |
Creates a new label and inserts it into m_labels. | |
bool | planarityCheck (node v1, node v2) |
Checks planarity for a new edge (v1 , v2 ) in the original graph. | |
void | reduceChain (node pendant, pa_label labelOld=nullptr) |
Traverses to the root and creates a label or updates one. | |
void | removeAllPendants (pa_label &label) |
Removes all pendants of label . | |
void | terminate () |
Cleanup. | |
void | updateAdjNonChildren (node newBlock, SList< node > &path) |
Updates m_adjNonChildren. | |
void | updateNewEdges (const SList< edge > &newEdges) |
Major updates caused by the new edges. | |
Private Attributes | |
NodeArray< SList< adjEntry > > | m_adjNonChildren |
Stores for each node of the bc-tree the children that have an adjacent bc-node that doesn't belong to the same parent-node. | |
NodeArray< pa_label > | m_belongsTo |
The label a BC-Node belongs to. | |
NodeArray< ListIterator< pa_label > > | m_isLabel |
The list iterator in m_labels if the node in the BC-Tree is a label. | |
List< pa_label > | m_labels |
The list of all labels, sorted by size (decreasing). | |
int | m_nPlanarityTests = 0 |
The number of planarity tests. | |
DynamicBCTree * | m_pBCTree = nullptr |
The corresponding BC-Tree. | |
List< node > | m_pendants |
The list of all pendants (leaves in the BC-Tree). | |
List< node > | m_pendantsToDel |
The list of pendants that has to be deleted after each reduceChain. | |
Graph * | m_pGraph = nullptr |
The working graph. | |
List< edge > * | m_pResult = nullptr |
The inserted edges by the algorithm. | |
The algorithm for planar biconnectivity augmentation (Mutzel, Fialko).
The class PlanarAugmentation implements an augmentation algorithm that augments a graph to a biconnected graph. In addition, if the graph was planar before augmentation, the resulting graph will be biconnected and planar. The algorithm uses (dynamic) BC-trees and achieves biconnectivity by inserting edges between nodes of pendants (that are leaves in the bc-tree). The guaranteed approximation-quality is 5/3.
The implementation is based on the following publication:
Sergej Fialko, Petra Mutzel: A New Approximation Algorithm for the Planar Augmentation Problem. Proc. SODA 1998, pp. 260-269.
Definition at line 59 of file PlanarAugmentation.h.
|
inline |
Creates an instance of the planar augmentation algorithm.
Definition at line 62 of file PlanarAugmentation.h.
|
inline |
Destruction.
Definition at line 65 of file PlanarAugmentation.h.
Adds pendant
to label
and updates the label-order.
Returns a node that belongs to bc-node v
and is adjacent to cutvertex
.
v | is a node in the BC-Tree. |
cutvertex | is the last cut-vertex found. |
|
private |
The main function for planar augmentation.
Checks if the pendants of label a
and label b
can be connected without creating a new pendant.
Connects the only pendant of label
with a computed ancestor.
Inserts edges between pendants of label first
and second
.
first.size()
is greater than second.size()
or equal. Connects two pendants.
Deletes label
.
Deletes the pendant pendant
, and, if removeFromLabel
is true, removes it from the corresponding label and updates the label-order.
|
overrideprotectedvirtual |
The implementation of the algorithm call.
G | is the working graph. |
list | is the list of all new edges. |
Implements ogdf::AugmentationModule.
Traverses from pendant
to ancestor
and returns the last node before ancestor on the path.
Finds two matching labels, so all pendants can be connected without losing planarity.
first | is the label with maximum size, modified by the function. |
second | is the matching label, modified by the function: 0 if no matching is found. |
|
private |
Traverses to the root and checks several stop conditions.
Is called by reduceChain.
v | is a node of the BC-Tree. |
last | is the last found C-vertex in the BC-Tree, is modified by the method. |
|
private |
Inserts label
into m_labels by decreasing order.
Connects all pendants of label
with new edges.
|
private |
Makes the graph connected by new edges between pendants of the connected components.
Modifies the root of the BC-Tree that newRoot
replaces oldRoot
.
|
private |
Creates a new label and inserts it into m_labels.
Checks planarity for a new edge (v1
, v2
) in the original graph.
v1 | is a node in the original graph. |
v2 | is a node in the original graph. |
Traverses to the root and creates a label or updates one.
Is called for every pendant node.
pendant | is a pendant in the BC-Tree. |
labelOld | is the old label of pendant . |
Removes all pendants of label
.
|
private |
Cleanup.
Updates m_adjNonChildren.
newBlock | is a new created block of the BC-Tree. |
path | is the path in the BC-Tree between the two connected nodes. |
Major updates caused by the new edges.
newEdges | is a list of all new edges. |
Stores for each node of the bc-tree the children that have an adjacent bc-node that doesn't belong to the same parent-node.
This is necessary because the bc-tree uses an union-find-data-structure to store dependencies between bc-nodes. The adjacencies in the bc-tree won't be updated.
Definition at line 112 of file PlanarAugmentation.h.
The label a BC-Node belongs to.
Definition at line 100 of file PlanarAugmentation.h.
|
private |
The list iterator in m_labels if the node in the BC-Tree is a label.
Definition at line 103 of file PlanarAugmentation.h.
The list of all labels, sorted by size (decreasing).
Definition at line 91 of file PlanarAugmentation.h.
|
private |
The number of planarity tests.
Definition at line 79 of file PlanarAugmentation.h.
|
private |
The corresponding BC-Tree.
Definition at line 85 of file PlanarAugmentation.h.
The list of all pendants (leaves in the BC-Tree).
Definition at line 94 of file PlanarAugmentation.h.
The list of pendants that has to be deleted after each reduceChain.
Definition at line 97 of file PlanarAugmentation.h.
The working graph.
Definition at line 82 of file PlanarAugmentation.h.
The inserted edges by the algorithm.
Definition at line 88 of file PlanarAugmentation.h.