Open
Graph Drawing
Framework

 v.2015.05
 

ogdf::DynamicSPQRTree Class Reference

Linear-time implementation of dynamic SPQR-trees. More...

#include <ogdf/decomposition/DynamicSPQRTree.h>

+ Inheritance diagram for ogdf::DynamicSPQRTree:

Public Member Functions

 DynamicSPQRTree (Graph &G)
 Creates an SPQR tree T for graph G rooted at the first edge of G. More...
 
 DynamicSPQRTree (Graph &G, edge e)
 Creates an SPQR tree T for graph G rooted at the edge e. More...
 
 ~DynamicSPQRTree ()
 
edge copyOfReal (edge e) const
 Returns the skeleton edge that corresponds to the real edge e. More...
 
SList< node > & findPath (node s, node t)
 Finds the shortest path between the two sets of vertices of T which s and t of G belong to. More...
 
List< nodenodesOfType (NodeType t) const
 Returns the list of all nodes with type t. More...
 
int numberOfPNodes () const
 Returns the number of P-nodes in T. More...
 
int numberOfRNodes () const
 Returns the number of R-nodes in T. More...
 
int numberOfSNodes () const
 Returns the number of S-nodes in T. More...
 
const GraphoriginalGraph () const
 Returns a reference to the original graph G. More...
 
edge rootEdge () const
 Returns the edge of G at which T is rooted. More...
 
node rootNode () const
 Returns the root node of T. More...
 
node rootTreeAt (edge e)
 Roots T at edge e and returns the new root node of T. More...
 
node rootTreeAt (node v)
 Roots T at node v and returns v. More...
 
Skeletonskeleton (node v) const
 Returns the skeleton of node v. More...
 
edge skeletonEdge (node v, node w) const
 Returns the virtual edge in the skeleton of w that corresponds to the tree edge between v and w. More...
 
const SkeletonskeletonOfReal (edge e) const
 Returns the skeleton that contains the real edge e. More...
 
const Graphtree () const
 Returns a reference to the tree T. More...
 
NodeType typeOf (node v) const
 Returns the type of node v. More...
 
edge updateInsertedEdge (edge e)
 Updates the whole data structure after a new edge e has been inserted into G. More...
 
node updateInsertedNode (edge e, edge f)
 Updates the whole data structure after a new vertex has been inserted into G by splitting an edge into e and f. More...
 
- Public Member Functions inherited from ogdf::SPQRTree
virtual ~SPQRTree ()
 
void directSkEdge (node vT, edge e, node src)
 
void pertinentGraph (node v, PertinentGraph &Gp) const
 Returns the pertinent graph of tree node v in Gp. More...
 
void replaceSkEdgeByPeak (node vT, edge e)
 
- Public Member Functions inherited from ogdf::DynamicSPQRForest
 DynamicSPQRForest (Graph &G)
 A constructor. More...
 
node spqrproper (edge eH) const
 finds the proper representative of the SPQR-tree-vertex which a given real or virtual edge is belonging to. More...
 
edge twinEdge (edge eH) const
 returns the twin edge of a given edge of m_H, if it is virtual, or NULL, if it is real. More...
 
TNodeType typeOfTNode (node vT) const
 returns the type of the triconnected component represented by a given SPQR-tree-vertex. More...
 
const List< edge > & hEdgesSPQR (node vT) const
 returns a linear list of the edges in m_H belonging to the triconnected component represented by a given SPQR-tree-vertex. More...
 
SList< node > & findPathSPQR (node sH, node tH) const
 finds the shortest path between the two sets of SPQR-tree-vertices which sH and tH are belonging to. More...
 
edge virtualEdge (node vT, node wT) const
 returns the virtual edge which leads from one vertex of an SPQR-tree to another one. More...
 
- Public Member Functions inherited from ogdf::DynamicBCTree
 DynamicBCTree (Graph &G, bool callInitConnected=false)
 A constructor. More...
 
 DynamicBCTree (Graph &G, node vG, bool callInitConnected=false)
 A constructor. More...
 
node bcproper (node vG) const
 returns a BC-tree-vertex representing a biconnected component which a given vertex of the original graph is belonging to. More...
 
node bcproper (edge eG) const
 returns the BC-tree-vertex representing the biconnected component which a given edge of the original graph is belonging to. More...
 
node repVertex (node uG, node vB) const
 returns a vertex of the biconnected components graph corresponding to a given vertex of the original graph and belonging to the representation of a certain biconnected component given by a vertex of the BC-tree. More...
 
node cutVertex (node uB, node vB) const
 returns the copy of a cut-vertex in the biconnected components graph which belongs to a certain B-component and leads to another B-component. More...
 
edge insertEdge (node sG, node tG)
 inserts a new edge into the original graph and updates the BC-tree. More...
 
node insertNode (edge eG)
 inserts a new vertex into the original graph and updates the BC-tree. More...
 
node bComponent (node uG, node vG) const
 returns the BC-tree-vertex representing the B-component which two given vertices of the original graph are belonging to. More...
 
- Public Member Functions inherited from ogdf::BCTree
 BCTree (Graph &G, bool callInitConnected=false)
 A constructor. More...
 
 BCTree (Graph &G, node vG, bool callInitConnected=false)
 A constructor. More...
 
virtual ~BCTree ()
 Virtual destructor. More...
 
const GraphoriginalGraph () const
 returns the original graph. More...
 
const GraphbcTree () const
 returns the BC-tree graph. More...
 
const GraphauxiliaryGraph () const
 returns the biconnected components graph. More...
 
int numberOfBComps () const
 returns the number of B-components. More...
 
int numberOfCComps () const
 returns the number of C-components. More...
 
GNodeType typeOfGNode (node vG) const
 returns the type of a vertex of the original graph. More...
 
node rep (node vG) const
 returns a vertex of the biconnected components graph corresponding to a given vertex of the original graph. More...
 
edge rep (edge eG) const
 returns the edge of the biconnected components graph corresponding to a given edge of the original graph. More...
 
node original (node vH)
 returns the vertex of the original graph which a given vertex of the biconnected components graph is corresponding to. More...
 
edge original (edge eH) const
 returns the edge of the original graph which a given edge of the biconnected components graph is corresponding to. More...
 
BNodeType typeOfBNode (node vB) const
 returns the type of the biconnected component represented by a given BC-tree-vertex. More...
 
const SList< edge > & hEdges (node vB) const
 returns a linear list of the edges of the biconnected components graph belonging to the biconnected component represented by a given BC-tree-vertex. More...
 
int numberOfEdges (node vB) const
 returns the number of edges belonging to the biconnected component represented by a given BC-tree-vertex. More...
 
int numberOfNodes (node vB) const
 returns the number of vertices belonging to the biconnected component represented by a given BC-tree-vertex. More...
 
node bComponent (node uG, node vG) const
 returns the BC-tree-vertex representing the B-component which two given vertices of the original graph are belonging to. More...
 
SList< node > & findPath (node sG, node tG) const
 calculates a path in the BC-tree. More...
 
SList< node > * findPathBCTree (node sB, node tB) const
 calculates a path in the BC-tree. More...
 

Protected Member Functions

void cpRec (node v, PertinentGraph &Gp) const
 Recursively performs the task of adding edges (and nodes) to the pertinent graph Gp for each involved skeleton graph. More...
 
DynamicSkeletoncreateSkeleton (node vT) const
 Creates the skeleton graph belonging to a given vertex vT of T. More...
 
void init (edge e)
 Initialization (called by constructors). More...
 
- Protected Member Functions inherited from ogdf::SPQRTree
edge cpAddEdge (edge eOrig, PertinentGraph &Gp) const
 Add an edge to Gp corresponding to eOrig. More...
 
node cpAddNode (node vOrig, PertinentGraph &Gp) const
 Add a node to Gp corresponding to vOrig if required. More...
 
- Protected Member Functions inherited from ogdf::DynamicSPQRForest
void createSPQR (node vB) const
 creates the SPQR-tree for a given B-component of the BC-tree. More...
 
void init ()
 Initialization. More...
 
node uniteSPQR (node vB, node sT, node tT)
 unites two SPQR-tree-vertices (UNION part of UNION/FIND). More...
 
node findSPQR (node vT) const
 finds the proper representative of an SPQR-tree-vertex (FIND part of UNION/FIND). More...
 
node findNCASPQR (node sT, node tT) const
 finds the nearest common ancestor of sT and tT. More...
 
SList< node > & findPathSPQR (node sH, node tH, node &rT) const
 finds the shortest path between the two sets of SPQR-tree-vertices which sH and tH are belonging to. More...
 
edge updateInsertedEdgeSPQR (node vB, edge eG)
 updates an SPQR-tree after a new edge has been inserted into the original graph. More...
 
node updateInsertedNodeSPQR (node vB, edge eG, edge fG)
 updates an SPQR-tree after a new vertex has been inserted into the original graph by splitting an edge into eG and fG. More...
 
- Protected Member Functions inherited from ogdf::DynamicBCTree
void init ()
 Initialization of m_bNode_owner and m_bNode_degree. More...
 
node unite (node uB, node vB, node wB)
 The UNION function of the UNION/FIND structure. More...
 
node find (node vB) const
 The FIND function of the UNION/FIND structure. More...
 
node parent (node vB) const
 returns the parent of a given BC-tree-vertex. More...
 
node condensePath (node sG, node tG)
 performs path condensation. More...
 
- Protected Member Functions inherited from ogdf::BCTree
void biComp (adjEntry adjuG, node vG)
 generates the BC-tree and the biconnected components graph recursively. More...
 
void init (node vG)
 Initialization. More...
 
void initNotConnected (node vG)
 Initialization for not connected graphs. More...
 
node findNCA (node uB, node vB) const
 calculates the nearest common ancestor of two vertices of the BC-tree. More...
 

Protected Attributes

NodeArray< nodem_mapV
 temporary array used by createSkeleton() More...
 
edge m_rootEdge
 edge of G at which T is rooted More...
 
NodeArray< DynamicSkeleton * > m_sk
 pointer to skeleton of a node in T More...
 
EdgeArray< edgem_skelEdge
 copies of real and virtual edges in their skeleton graphs (invalid, if the skeleton does not actually exist) More...
 
- Protected Attributes inherited from ogdf::SPQRTree
NodeArray< node > * m_cpV
 node in pertinent graph corresponding to an original node (auxiliary member) More...
 
SList< nodem_cpVAdded
 list of added nodes (auxiliary member) More...
 
- Protected Attributes inherited from ogdf::DynamicSPQRForest
Graph m_T
 A Graph structure containing all SPQR-trees. More...
 
NodeArray< nodem_bNode_SPQR
 The root vertices of the SPQR-trees. More...
 
NodeArray< int > m_bNode_numS
 The numbers of S-components. More...
 
NodeArray< int > m_bNode_numP
 The numbers of P-components. More...
 
NodeArray< int > m_bNode_numR
 The numbers of R-components. More...
 
NodeArray< TNodeTypem_tNode_type
 The types of the SPQR-tree-vertices. More...
 
NodeArray< nodem_tNode_owner
 The owners of the SPQR-tree-vertices in the UNION/FIND structure. More...
 
NodeArray< edgem_tNode_hRefEdge
 The virtual edges leading to the parents of the SPQR-tree-vertices. More...
 
NodeArray< List< edge > > m_tNode_hEdges
 Lists of real and virtual edges belonging to SPQR-tree-vertices. More...
 
EdgeArray< ListIterator< edge > > m_hEdge_position
 The positions of real and virtual edges in their m_tNode_hEdges lists. More...
 
EdgeArray< nodem_hEdge_tNode
 The SPQR-tree-vertices which the real and virtual edges are belonging to. More...
 
EdgeArray< edgem_hEdge_twinEdge
 The partners of virtual edges (NULL if real). More...
 
NodeArray< nodem_htogc
 Auxiliary array used by createSPQR(). More...
 
NodeArray< bool > m_tNode_isMarked
 Auxiliary array used by findNCASPQR() More...
 
- Protected Attributes inherited from ogdf::DynamicBCTree
NodeArray< int > m_bNode_degree
 Array that contains for each proper BC-tree-vertex its degree. More...
 
NodeArray< nodem_bNode_owner
 Array that contains for each BC-tree-vertex its parent in its UNION/FIND-tree structure. More...
 
- Protected Attributes inherited from ogdf::BCTree
Graph m_B
 The BC-tree. More...
 
Graphm_G
 The original graph. More...
 
Graph m_H
 The biconnected components graph. More...
 
int m_numB
 The number of B-components. More...
 
int m_numC
 The number of C-components. More...
 
NodeArray< bool > m_gNode_isMarked
 Array of marks for the vertices of the original graph. More...
 
NodeArray< nodem_gNode_hNode
 An injective mapping vertices(G) -> vertices(H). More...
 
EdgeArray< edgem_gEdge_hEdge
 A bijective mapping edges(G) -> edges(H). More...
 
NodeArray< BNodeTypem_bNode_type
 Array that contains the type of each BC-tree-vertex. More...
 
NodeArray< bool > m_bNode_isMarked
 Array of marks for the BC-tree-vertices. More...
 
NodeArray< nodem_bNode_hRefNode
 Array that contains for each BC-tree-vertex the representant of its parent within the subgraph in the biconnected components graph belonging to the biconnected component represented by the respective BC-tree-vertex. More...
 
NodeArray< nodem_bNode_hParNode
 Array that contains for each BC-tree-vertex the representant of itself within the subgraph in the biconnected components graph belonging to the biconnected component represented by the parent of the respective BC-tree-vertex. More...
 
NodeArray< SList< edge > > m_bNode_hEdges
 Array that contains for each BC-tree-vertex a linear list of the edges of the biconnected components graph belonging to the biconnected component represented by the respective BC-tree-vertex. More...
 
NodeArray< int > m_bNode_numNodes
 Array that contains for each BC-tree-vertex the number of vertices belonging to the biconnected component represented by the respective BC-tree-vertex. More...
 
NodeArray< nodem_hNode_bNode
 A surjective mapping vertices(H) -> vertices(B). More...
 
EdgeArray< nodem_hEdge_bNode
 A surjective mapping edges(H) -> vertices(B). More...
 
NodeArray< nodem_hNode_gNode
 A surjective mapping vertices(H) -> vertices(G). More...
 
EdgeArray< edgem_hEdge_gEdge
 A bijective mapping edges(H) -> edges(G). More...
 
int m_count
 Temporary variable. More...
 
NodeArray< int > m_number
 Temporary array. More...
 
NodeArray< int > m_lowpt
 Temporary array. More...
 
BoundedStack< adjEntrym_eStack
 Temporary stack. More...
 
NodeArray< nodem_gtoh
 Temporary array. More...
 
SList< nodem_nodes
 Temporary list. More...
 

Friends

class DynamicSkeleton
 

Additional Inherited Members

- Public Types inherited from ogdf::SPQRTree
enum  NodeType { SNode, PNode, RNode }
 The type of a tree node in T. More...
 
- Public Types inherited from ogdf::DynamicSPQRForest
enum  TNodeType { SComp = SPQRTree::SNode, PComp = SPQRTree::PNode, RComp = SPQRTree::RNode }
 Enumeration type for characterizing the SPQR-tree-vertices. More...
 
- Public Types inherited from ogdf::BCTree
enum  BNodeType { BComp, CComp }
 Enumeration type for characterizing the BC-tree-vertices. More...
 
enum  GNodeType { Normal, CutVertex }
 Enumeration type for characterizing the vertices of the original graph. More...
 

Detailed Description

Linear-time implementation of dynamic SPQR-trees.

The class DynamicSPQRTree maintains the arrangement of the triconnected components of a biconnected multi-graph G [Hopcroft, Tarjan 1973] as a so-called SPQR tree T [Fi Battista, Tamassia, 1996]. We call G the original graph of T. The class DynamicSPQRTree supports the statical construction of an SPQR-tree for a given graph G, and supports dynamic updates, too.

Each node of the tree has an associated type (represented by SPQRTree::NodeType), which is either SNode, PNode, or RNode, and a skeleton (represented by the class DynamicSkeleton). The skeletons of the nodes of T are in one-to-one correspondence to the triconnected components of G, i.e., S-nodes correspond to polygons, P-nodes to bonds, and R-nodes to triconnected graphs.

In our representation of SPQR-trees, Q-nodes are omitted. Instead, the skeleton S of a node v in T contains two types of edges: real edges, which correspond to edges in G, and virtual edges, which correspond to edges in T having v as an endpoint. There is a special edge er in G at which T is rooted, i.e., the root node of T is the node whose skeleton contains the real edge corresponding to er.

The reference edge of the skeleton of the root node is er, the reference edge of the skeleton S of a non-root node v is the virtual edge in S that corresponds to the tree edge (parent(v),v).

Definition at line 96 of file DynamicSPQRTree.h.

Constructor & Destructor Documentation

ogdf::DynamicSPQRTree::DynamicSPQRTree ( Graph G)
inline

Creates an SPQR tree T for graph G rooted at the first edge of G.

Precondition
G is biconnected and contains at least 3 nodes, or G has exactly 2 nodes and at least 3 edges.

Definition at line 110 of file DynamicSPQRTree.h.

ogdf::DynamicSPQRTree::DynamicSPQRTree ( Graph G,
edge  e 
)
inline

Creates an SPQR tree T for graph G rooted at the edge e.

Precondition
e is in G, G is biconnected and contains at least 3 nodes, or G has exactly 2 nodes and at least 3 edges.

Definition at line 117 of file DynamicSPQRTree.h.

ogdf::DynamicSPQRTree::~DynamicSPQRTree ( )

Member Function Documentation

edge ogdf::DynamicSPQRTree::copyOfReal ( edge  e) const
inlinevirtual

Returns the skeleton edge that corresponds to the real edge e.

Precondition
e is an edge in G

Implements ogdf::SPQRTree.

Definition at line 186 of file DynamicSPQRTree.h.

void ogdf::DynamicSPQRTree::cpRec ( node  v,
PertinentGraph Gp 
) const
inlineprotectedvirtual

Recursively performs the task of adding edges (and nodes) to the pertinent graph Gp for each involved skeleton graph.

Implements ogdf::SPQRTree.

Definition at line 248 of file DynamicSPQRTree.h.

DynamicSkeleton& ogdf::DynamicSPQRTree::createSkeleton ( node  vT) const
protected

Creates the skeleton graph belonging to a given vertex vT of T.

SList<node>& ogdf::DynamicSPQRTree::findPath ( node  s,
node  t 
)
inline

Finds the shortest path between the two sets of vertices of T which s and t of G belong to.

Definition at line 163 of file DynamicSPQRTree.h.

void ogdf::DynamicSPQRTree::init ( edge  e)
protected

Initialization (called by constructors).

List<node> ogdf::DynamicSPQRTree::nodesOfType ( NodeType  t) const
virtual

Returns the list of all nodes with type t.

Implements ogdf::SPQRTree.

int ogdf::DynamicSPQRTree::numberOfPNodes ( ) const
inlinevirtual

Returns the number of P-nodes in T.

Implements ogdf::SPQRTree.

Definition at line 145 of file DynamicSPQRTree.h.

int ogdf::DynamicSPQRTree::numberOfRNodes ( ) const
inlinevirtual

Returns the number of R-nodes in T.

Implements ogdf::SPQRTree.

Definition at line 148 of file DynamicSPQRTree.h.

int ogdf::DynamicSPQRTree::numberOfSNodes ( ) const
inlinevirtual

Returns the number of S-nodes in T.

Implements ogdf::SPQRTree.

Definition at line 142 of file DynamicSPQRTree.h.

const Graph& ogdf::DynamicSPQRTree::originalGraph ( ) const
inlinevirtual

Returns a reference to the original graph G.

Implements ogdf::SPQRTree.

Definition at line 130 of file DynamicSPQRTree.h.

edge ogdf::DynamicSPQRTree::rootEdge ( ) const
inlinevirtual

Returns the edge of G at which T is rooted.

Implements ogdf::SPQRTree.

Definition at line 136 of file DynamicSPQRTree.h.

node ogdf::DynamicSPQRTree::rootNode ( ) const
inlinevirtual

Returns the root node of T.

Implements ogdf::SPQRTree.

Definition at line 139 of file DynamicSPQRTree.h.

node ogdf::DynamicSPQRTree::rootTreeAt ( edge  e)
virtual

Roots T at edge e and returns the new root node of T.

Precondition
e is an edge in G

Implements ogdf::SPQRTree.

node ogdf::DynamicSPQRTree::rootTreeAt ( node  v)
virtual

Roots T at node v and returns v.

Precondition
v is a node in T

Implements ogdf::SPQRTree.

Skeleton& ogdf::DynamicSPQRTree::skeleton ( node  v) const
inlinevirtual

Returns the skeleton of node v.

Precondition
v is a node in T

Implements ogdf::SPQRTree.

Definition at line 169 of file DynamicSPQRTree.h.

edge ogdf::DynamicSPQRTree::skeletonEdge ( node  v,
node  w 
) const
inline

Returns the virtual edge in the skeleton of w that corresponds to the tree edge between v and w.

Precondition
v and w are adjacent nodes in T

Definition at line 198 of file DynamicSPQRTree.h.

const Skeleton& ogdf::DynamicSPQRTree::skeletonOfReal ( edge  e) const
inlinevirtual

Returns the skeleton that contains the real edge e.

Precondition
e is an edge in G

Implements ogdf::SPQRTree.

Definition at line 180 of file DynamicSPQRTree.h.

const Graph& ogdf::DynamicSPQRTree::tree ( ) const
inlinevirtual

Returns a reference to the tree T.

Implements ogdf::SPQRTree.

Definition at line 133 of file DynamicSPQRTree.h.

NodeType ogdf::DynamicSPQRTree::typeOf ( node  v) const
inlinevirtual

Returns the type of node v.

Precondition
v is a node in T

Implements ogdf::SPQRTree.

Definition at line 154 of file DynamicSPQRTree.h.

edge ogdf::DynamicSPQRTree::updateInsertedEdge ( edge  e)
virtual

Updates the whole data structure after a new edge e has been inserted into G.

Reimplemented from ogdf::DynamicSPQRForest.

node ogdf::DynamicSPQRTree::updateInsertedNode ( edge  e,
edge  f 
)
virtual

Updates the whole data structure after a new vertex has been inserted into G by splitting an edge into e and f.

Reimplemented from ogdf::DynamicSPQRForest.

Friends And Related Function Documentation

friend class DynamicSkeleton
friend

Definition at line 100 of file DynamicSPQRTree.h.

Member Data Documentation

NodeArray<node> ogdf::DynamicSPQRTree::m_mapV
mutableprotected

temporary array used by createSkeleton()

Definition at line 263 of file DynamicSPQRTree.h.

edge ogdf::DynamicSPQRTree::m_rootEdge
protected

edge of G at which T is rooted

Definition at line 259 of file DynamicSPQRTree.h.

NodeArray<DynamicSkeleton*> ogdf::DynamicSPQRTree::m_sk
mutableprotected

pointer to skeleton of a node in T

Definition at line 261 of file DynamicSPQRTree.h.

EdgeArray<edge> ogdf::DynamicSPQRTree::m_skelEdge
mutableprotected

copies of real and virtual edges in their skeleton graphs (invalid, if the skeleton does not actually exist)

Definition at line 262 of file DynamicSPQRTree.h.


The documentation for this class was generated from the following file: