Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
SyncPlanComponents.h
Go to the documentation of this file.
1
31#pragma once
32
33#include <ogdf/basic/Graph.h>
35#include <ogdf/basic/basic.h>
38
39#include <functional>
40#include <iosfwd>
41#include <utility>
42
43namespace ogdf {
44template<class E>
45class List;
46template<class E>
47class SList;
48template<class E>
49class SListPure;
50} // namespace ogdf
51
52namespace ogdf::sync_plan {
53namespace internal {
54struct EncapsulatedBlock;
55}
56
59 friend class SyncPlan;
60
61 friend class SyncPlanConsistency;
62
63 friend class SyncPlanDrawer;
64
65private:
68 int conn_count, conn_next_id;
69
75
76 mutable int counter = 1;
77 mutable NodeArray<std::pair<int, edge>> marker; // used by graphEdgeToBCEdge
78
79public:
80 explicit SyncPlanComponents(Graph* g) : G(g), BC(), marker(BC, std::pair(0, nullptr)) {
81 reset();
82 }
83
84 int connectedCount() const { return conn_count; }
85
86 int connectedId(node n) const { return bcConnectedId(biconnectedComponent(n)); }
87
88 int biconnectedId(node n) const { return biconnectedComponent(n)->index(); }
89
91
93
94 bool isCutVertex(node n) const { return nodeType(n) == BCTree::GNodeType::CutVertex; }
95
96 Graph& graph() const { return *G; }
97
98 const Graph& bcTree() const { return BC; }
99
101
102 bool isCutComponent(node n) const { return bcNodeType(n) == BCTree::BNodeType::CComp; }
103
104 int bcSize(node n) const;
105
106 int bcConnectedId(node n) const;
107
108 node bcRepr(node bc) const;
109
111
112 std::function<std::ostream&(std::ostream&)> fmtBCNode(node bc) const;
113
114 std::function<std::ostream&(std::ostream&)> fmtBCOf(node n) const {
115 return fmtBCNode(biconnectedComponent(n));
116 }
117
119
120 std::pair<edge, edge> graphEdgeToBCEdge(node bc_src, node bc_tgt) const;
121
122 node findCommonBiconComp(node bc_cut1, node bc_cut2) const;
123
124 void biconReprNodes(node bicon, SList<node>& nodes) const;
125
127
129
130private:
131 void reset() {
132 conn_count = conn_next_id = 0;
133 bc_conn_id.init(BC, -1);
134 g_bc.init(*G, nullptr);
135 bc_g.init(BC, nullptr);
136 bc_size.init(BC, 0);
137 bc_type.init(BC, BCTree::BNodeType::BComp);
138 }
139
140 void makeRepr(node bc, node n);
141
142 void nodeInserted(node g_n, node bc_n);
143
144 void insert(BCTree& tmp_bc);
145
146 void cutReplacedByWheel(node centre, const NodeArray<SList<adjEntry>>& block_neigh);
147
148 void relabelExplodedStar(node center1, node center2, List<node> remnants);
149
150 void preJoin(node keep, node merge);
151
153
155};
156
162 NodeArray<SListPure<adjEntry>> m_adjEntries; // room for improvement: replace by contiguous vector + indices
164
165public:
167
168 ~BiconnectedIsolation() { restore(); }
169
170 void restore(bool restore_embedding = true);
171};
172}
Declaration of class BCTree.
An iterator-based BFS through a Graph.
Includes declaration of graph class.
Declaration and implementation of NodeSet, EdgeSet, and AdjEntrySet classes.
Basic declarations, included by all source files.
Static BC-trees.
Definition BCTree.h:60
BNodeType
Enumeration type for characterizing the BC-tree-vertices.
Definition BCTree.h:71
GNodeType
Enumeration type for characterizing the vertices of the original graph.
Definition BCTree.h:63
An iterator-based BFS through a Graph.
Functionality for temporarily hiding edges in constant time.
Definition Graph_d.h:1222
Data type for general directed graphs (adjacency list representation).
Definition Graph_d.h:866
Doubly linked lists (maintaining the length of the list).
Definition List.h:1451
Class for the representation of nodes.
Definition Graph_d.h:241
Node sets.
Definition GraphSets.h:54
void init(const Base *base=nullptr)
Reinitializes the array. Associates the array with the matching registry of base.
Singly linked lists (maintaining the length of the list).
Definition SList.h:845
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition Graph_d.h:659
Hides all (edges leading to) adjacent biconnected components without changing the current embedding.
BiconnectedIsolation(SyncPlanComponents &comps, node bicon)
NodeArray< SListPure< adjEntry > > m_adjEntries
void restore(bool restore_embedding=true)
(Bi)Connected components information maintained during the SyncPlan algorithm.
void postSplitOffEncapsulatedBlock(node cut, internal::EncapsulatedBlock &block)
std::pair< edge, edge > graphEdgeToBCEdge(node bc_src, node bc_tgt) const
FilteringBFS nodesInBiconnectedComponent(node bicon) const
std::function< std::ostream &(std::ostream &)> fmtBCOf(node n) const
void nodeInserted(node g_n, node bc_n)
NodeArray< std::pair< int, edge > > marker
node biconnectedComponent(node n) const
std::function< std::ostream &(std::ostream &)> fmtBCNode(node bc) const
BCTree::BNodeType bcNodeType(node n) const
BCTree::GNodeType nodeType(node n) const
void biconReprNodes(node bicon, SList< node > &nodes) const
void makeRepr(node bc, node n)
void cutReplacedByWheel(node centre, const NodeArray< SList< adjEntry > > &block_neigh)
node findCommonBiconComp(node bc_cut1, node bc_cut2) const
NodeArray< BCTree::BNodeType > bc_type
void relabelExplodedStar(node center1, node center2, List< node > remnants)
void preJoin(node keep, node merge)
Consistency checks for debugging the SyncPlan algorithm.
Utilities by dumping a drawing of the current state of a SyncPlan instance.
A class for modelling and solving Synchronized Planarity instances.
Definition SyncPlan.h:124
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF dynamic library (shared object / DLL),...
Definition config.h:117
The namespace for all OGDF objects.
long long nodeType
Definition GML.h:111
Information on a single block adjacent to a cut-vertex that is about to be encapsulated.
Definition Encapsulate.h:41