BFS tree used by both classical algorithms (LT and Dual). More...
#include <ogdf/graphalg/PlanarSeparatorModule.h>
Public Member Functions | |
BFSTreeClassical (GraphCopy &G, node rootNode, unsigned int heightMaxIterations, bool findLevelsSimple=false) | |
Constructor. | |
~BFSTreeClassical () | |
void | construct (node rootNode, unsigned int numIterations) |
Constructs the tree. | |
void | createNewRoot (bool useTriBFS=false) |
Creates a new root node for the graph, replacing all levels below t0. | |
int | get_t0 () const |
int | get_t1 () const |
int | get_t2 () const |
List< node > | getLevel (int level) const |
Returns a level of the tree. | |
List< node > | getNodesFrom (int start) const |
Returns all nodes from a given level onwards. | |
List< node > | getNodesFromTo (int start, int end) const |
Returns all nodes between two levels. | |
int | getSeparatorLevel () const |
int | getSizeOfLevel (int level) const |
Gets the size of a specific level. | |
bool | isVisited (node n) const |
Checks whether a node is visited by BFS. | |
void | reconstruct () |
Reconstructs the tree using triangulating bfs. | |
void | removeSeparatorLevels (List< node > &separator, List< node > &second) |
Removes the two separator levels t0 and t2 from the tree. | |
void | restructure (List< node > &separator, List< node > &second, bool useTriBFS=false) |
Restructures the tree by adding a new root and deleting all nodes below t0 and above t2, adding all nodes that are removed to the second component and keeping levels t0 and t2 in the separator. | |
Public Member Functions inherited from ogdf::planar_separators::ArrayBFSTree | |
ArrayBFSTree (GraphCopy &G, node rootNode) | |
Constructor. | |
adjEntry | getAdjToParent (node n) const override |
Returns the adjEntry that leads up to the parent of n . | |
List< node > | getChildrenOfNode (node n) const override |
Returns all (immediate) children of a node. | |
int | getDescendantsOfNode (node n) const override |
Returns the total number of children, grandchildren etc. | |
GraphCopy * | getGraph () const override |
Allows access to a copy of the graph. | |
int | getGraphSize () const override |
Gets the number of nodes of the graph. | |
int | getLevelOfNode (node n) const override |
Returns the level (=depth in the tree) for a node. | |
node | getParentOfNode (node n) const override |
Returns the node that is the parent of n in the tree. | |
node | getRoot () const override |
Gets the current root node of the tree. | |
void | init () |
Initializes all internal arrays. | |
bool | isInTree (edge e) const override |
Checks if an edge is a tree-edge. | |
Public Member Functions inherited from ogdf::planar_separators::BFSTree | |
virtual | ~BFSTree ()=default |
Protected Member Functions | |
void | findLevels () |
Finds the levels t0 and t2 of the tree that might serve as separators. | |
void | findLevelsSimple () |
Simplified version of findLevels that simply finds a level smaller than sqrt(n). | |
Private Member Functions | |
void | visit (node v, node parent, adjEntry adj, SListPure< node > &bfs) |
Private Attributes | |
bool | belowMiddle = true |
int | currentLevel = 0 |
unsigned int | heightMaxIterations |
int | k |
List< List< node > > | levels |
double | m_ratio |
bool | simple |
int | t0 |
int | t1 |
int | t2 |
Additional Inherited Members | |
Protected Attributes inherited from ogdf::planar_separators::ArrayBFSTree | |
NodeArray< List< node > > | childrenOfNode |
NodeArray< int > | descendantsOfNode |
NodeArray< adjEntry > | edgeToParent |
EdgeArray< bool > | inTree |
NodeArray< int > | levelOfNode |
NodeArray< bool > | mark |
NodeArray< node > | parentOfNode |
GraphCopy * | pGraph |
node | root |
BFS tree used by both classical algorithms (LT and Dual).
Definition at line 224 of file PlanarSeparatorModule.h.
ogdf::planar_separators::BFSTreeClassical::BFSTreeClassical | ( | GraphCopy & | G, |
node | rootNode, | ||
unsigned int | heightMaxIterations, | ||
bool | findLevelsSimple = false |
||
) |
Constructor.
G | the graph |
rootNode | node at which tree should be rooted |
heightMaxIterations | how many iterations of tree height maximization to run |
findLevelsSimple | whether the levels should be found using the simple method or not |
|
inline |
Definition at line 237 of file PlanarSeparatorModule.h.
void ogdf::planar_separators::BFSTreeClassical::construct | ( | node | rootNode, |
unsigned int | numIterations | ||
) |
Constructs the tree.
rootNode | the root node at which construction starts in this iteration |
numIterations | how many iterations of tree height maximization to run |
Creates a new root node for the graph, replacing all levels below t0.
useTriBFS | whether to use triangulating BFS or not |
|
protected |
Finds the levels t0 and t2 of the tree that might serve as separators.
This is the original version described by Lipton & Tarjan.
|
protected |
Simplified version of findLevels that simply finds a level smaller than sqrt(n).
|
inline |
Definition at line 320 of file PlanarSeparatorModule.h.
|
inline |
Definition at line 322 of file PlanarSeparatorModule.h.
|
inline |
Definition at line 324 of file PlanarSeparatorModule.h.
Returns a level of the tree.
level | index of the desired level |
Returns all nodes from a given level onwards.
start | index of the start level |
Returns all nodes between two levels.
start | index of the start level |
end | index of the end level |
|
inline |
Definition at line 318 of file PlanarSeparatorModule.h.
Gets the size of a specific level.
level | index of the desired level |
Checks whether a node is visited by BFS.
n | the node |
Definition at line 316 of file PlanarSeparatorModule.h.
void ogdf::planar_separators::BFSTreeClassical::reconstruct | ( | ) |
Reconstructs the tree using triangulating bfs.
void ogdf::planar_separators::BFSTreeClassical::removeSeparatorLevels | ( | List< node > & | separator, |
List< node > & | second | ||
) |
Removes the two separator levels t0 and t2 from the tree.
separator | the list of separator nodes |
second | the second component |
void ogdf::planar_separators::BFSTreeClassical::restructure | ( | List< node > & | separator, |
List< node > & | second, | ||
bool | useTriBFS = false |
||
) |
Restructures the tree by adding a new root and deleting all nodes below t0 and above t2, adding all nodes that are removed to the second component and keeping levels t0 and t2 in the separator.
separator | the list of separator nodes |
second | the second component of the separation |
useTriBFS | whether to use triangulating BFS |
|
private |
Definition at line 347 of file PlanarSeparatorModule.h.
|
private |
Definition at line 346 of file PlanarSeparatorModule.h.
Definition at line 342 of file PlanarSeparatorModule.h.
|
private |
Definition at line 354 of file PlanarSeparatorModule.h.
Definition at line 340 of file PlanarSeparatorModule.h.
|
private |
Definition at line 348 of file PlanarSeparatorModule.h.
|
private |
Definition at line 343 of file PlanarSeparatorModule.h.
|
private |
Definition at line 351 of file PlanarSeparatorModule.h.
|
private |
Definition at line 352 of file PlanarSeparatorModule.h.
|
private |
Definition at line 353 of file PlanarSeparatorModule.h.