61class ClusterGraphAttributes;
83using tpc = std::chrono::high_resolution_clock;
84using tp =
const std::chrono::time_point<std::chrono::high_resolution_clock>;
86inline int64_t
dur_ms(
const tp::duration& d) {
87 return std::chrono::duration_cast<std::chrono::milliseconds>(d).count();
90inline int64_t
dur_ns(
const tp::duration& d) {
91 return std::chrono::duration_cast<std::chrono::nanoseconds>(d).count();
129 friend class SyncPlanOptions;
133 friend class UndoContract;
135 friend class UndoConvertSmall;
137 friend class UndoEncapsulate;
139 friend class UndoInitCluster;
141 friend class UndoPropagate;
145 friend class UndoSimplifyToroidal;
147 friend class UndoMakeWheel;
149 friend class EmbeddingTrees;
158 int consistency_nr = -1;
165 virtual std::ostream&
print(std::ostream& os)
const = 0;
167 virtual std::string
name()
const;
180 std::ostream&
print(std::ostream& os)
const override;
191 std::ostream&
print(std::ostream& os)
const override;
195 enum class Result { SUCCESS, NOT_APPLICABLE, INVALID_INSTANCE };
207#ifdef SYNCPLAN_OPSTATS
209 std::ofstream stats_out;
210 uint64_t stats_pc_time = 0;
211 bool stats_first_in_array =
true;
236 bool indices_saved =
false;
238 bool allow_contract_bb_pipe =
false;
240 bool intersect_trees =
true;
242 bool batch_spqr =
true;
244 int longestSimplifyToroidalCycle = 0;
308 std::vector<std::pair<adjEntry, adjEntry>>* augmentation =
nullptr,
320 while (!undo_stack.
empty()) {
330 std::function<std::ostream&(std::ostream&)>
fmtPQNode(
node n,
bool include_comp =
true)
const;
406#ifdef SYNCPLAN_OPSTATS
410 void printOPStatsEnd(
bool success, int64_t time_ns);
431 allow_contract_bb_pipe = allowContractBbPipe;
Utilities for working with the bijections between the edges incident to the two endpoints of a Pipe.
Includes declaration of graph class.
Declaration and implementation of NodeSet, EdgeSet, and AdjEntrySet classes.
Declaration of doubly linked lists and iterators.
Contains logging functionality.
Manages the matching of P-nodes via pipes in an instance of SyncPlan.
Manages the partitioning of Q-nodes in an instance of SyncPlan.
(Bi)Connected components information maintained during the SyncPlan algorithm.
Consistency checks for debugging the SyncPlan algorithm.
Basic declarations, included by all source files.
Stores additional attributes of a clustered graph (like layout information).
Representation of clustered graphs.
Class for the representation of edges.
Functionality for temporarily hiding edges in constant time.
Stores additional attributes of a graph (like layout information).
Data type for general directed graphs (adjacency list representation).
Doubly linked lists (maintaining the length of the list).
int size() const
Returns the number of elements in the list.
iterator pushBack(const E &x)
Adds element x at the end of the list.
E popBackRet()
Removes the last element from the list and returns it.
bool empty() const
Returns true iff the list is empty.
Centralized global and local logging facility working on streams like std::cout.
Class for the representation of nodes.
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
RegisteredArray for nodes, edges and adjEntries of a graph.
This class represents the embedding tree of a single node in a biconnected component.
A PC-tree represents a set of cyclic orders of its leaves by labeling its inner nodes as either P- or...
Manages the matching of P-nodes via pipes in an instance of SyncPlan.
Manages the partitioning of Q-nodes in an instance of SyncPlan.
ResetIndices(SyncPlan &pq)
std::ostream & print(std::ostream &os) const override
void undo(SyncPlan &pq) override
The information needed for undoing the changes a specific operation made to the graph while maintaini...
friend std::ostream & operator<<(std::ostream &os, const SyncPlan::UndoOperation &undo_op)
virtual void undo(SyncPlan &pq)=0
virtual std::ostream & print(std::ostream &os) const =0
virtual std::string name() const
virtual ~UndoOperation()=default
std::ostream & print(std::ostream &os) const override
List< std::tuple< int, int, FrozenPipeBij > > pipes
VerifyPipeBijections(SyncPlan &pq)
void undo(SyncPlan &pq) override
(Bi)Connected components information maintained during the SyncPlan algorithm.
Consistency checks for debugging the SyncPlan algorithm.
int getCheckCounter() const
bool consistencyCheck(bool force_check_components=false)
Utilities by dumping a drawing of the current state of a SyncPlan instance.
A class for modelling and solving Synchronized Planarity instances.
void contractWheel(node centre)
Result simplify(node u, const NodePCRotation *pc)
Graph *const G
The underlying graph.
std::function< std::ostream &(std::ostream &)> fmtPQNode(node n, bool include_comp=true) const
PipeType getPipeType(const Pipe *p) const
void setBatchSpqr(bool batchSpqr)
Configure whether embedding trees should be computed in batch by deriving them from an SPQR-tree.
void pushUndoOperationAndCheck(UndoOperation *operation)
EdgeArray< edge > edge_reg
A mapping of edge-index to edge-object used while undoing operations.
node nodeFromIndex(int idx) const
Result propagatePQ(node u, NodePCRotation *pct, NodePCRotation *pct_v=nullptr)
bool makeReduced(int check_planarity_every=0)
Apply operations (in the order defined by the current PipeQueue) until no pipes are left.
NodeArray< node > node_reg
A mapping of node-index to node-object used while undoing operations.
bool verifyPipeBijection(node u, node v, const FrozenPipeBij &bij) const
SyncPlan(Graph *sefe, Graph *work, EdgeArray< uint8_t > &edge_types)
Create a new SyncPlan instance using the reduction from a 2-SEFE instance with a connected shared gra...
void formatNode(node n) const
SyncPlanConsistency consistency
Consistency checking utils.
edge edgeFromIndex(int idx) const
Result convertSmall(node small)
NodeArray< bool > is_wheel
Labels nodes whether they are already part of a (Q-node-replacement) wheel.
bool isAllowContractBBPipe() const
GraphAttributes * GA
If non-null, will be updated with debugging information from applied operations.
QPartitioning partitions
Collection of all Q-nodes and their partitions.
friend std::ostream & operator<<(std::ostream &os, const SyncPlan &pq)
SyncPlan(Graph *g, ClusterGraph *cg, std::vector< std::pair< adjEntry, adjEntry > > *augmentation=nullptr, ClusterGraphAttributes *ga=nullptr)
Create a new Synchronized Planarity instance by applying the reduction from some ClusteredPlanarity i...
int undoOperations() const
The number of operations that need undoing.
SyncPlan(Graph *g, GraphAttributes *ga=nullptr)
Create a new Synchronized Planarity instance with a given underlying graph.
void makeWheel(node centre, bool update_cuts=true)
void pushUndoOperation(UndoOperation *operation)
void setAllowContractBBPipe(bool allowContractBbPipe)
Configure whether block-block pipes can be contracted.
Graph::HiddenEdgeSet deletedEdges
Set of all edge objects deleted during the reduction, to be restored when undoing all operations.
bool isIntersectTrees() const
bool solveReduced(bool fail_fast=false)
Solve a reduced instance, creating a combinatorial embedding of the current graph that respects all Q...
Result
The result of applying a single operation.
NodeSet deletedNodes
Set of all node objects deleted during the reduction. Will remain as isolated nodes within G.
Result encapsulate(node g_cut)
SyncPlanComponents components
Data structure maintaining (bi)connected components information.
void embed()
Undo all operations while maintaining the current embedding to obtain an embedding of the initial gra...
PMatching matchings
Collection of all matched P-nodes and their pipes.
void thawPipeBijection(node u, node v, const FrozenPipeBij &in, PipeBij &out) const
List< UndoOperation * > undo_stack
Stack of all operations that should be undone when embedding.
bool canContract(const Pipe *p) const
Check whether a Pipe can be removed by applying contract().
int getLongestSimplifyToroidalCycle() const
Return the longest cycle length encountered in simplify toroidal.
const SyncPlanComponents & getComponents() const
The maintained (bi)connected components information.
void setIntersectTrees(bool intersectTrees)
Configure whether the embedding trees of block-block pipes should be intersected before propagating.
Result checkPCTree(node u)
Computes an embedding tree and either applies propagatePQ() or simplify()
Logger log
The logger to use.
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF dynamic library (shared object / DLL),...
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
int64_t dur_ms(const tp::duration &d)
int sumPNodeDegrees(const ogdf::pc_tree::PCTree &pct)
const std::chrono::time_point< std::chrono::high_resolution_clock > tp
std::chrono::high_resolution_clock tpc
int64_t dur_ns(const tp::duration &d)
std::ostream & operator<<(std::ostream &os, Operation op)
Operation
The reduction operations (and their distinct cases) implemented by SyncPlan.
The namespace for all OGDF objects.
A pair of matched vertices of the same degree, whose rotation shall be synchronized.