Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
CliqueReplacer.h
Go to the documentation of this file.
1
32#pragma once
33
34#include <ogdf/basic/Graph.h>
35#include <ogdf/basic/SList.h>
36#include <ogdf/basic/basic.h>
37#include <ogdf/basic/geometry.h>
38
39#include <algorithm>
40
41namespace ogdf {
42class GraphAttributes;
43template<class E>
44class List;
45
46namespace planarization_layout {
47
52
53 double m_cliqueCenterSize; //default size of inserted clique replacement center nodes
54 SListPure<node> m_centerNodes; //center nodes introduced at clique replacement
55
56 EdgeArray<bool> m_replacementEdge; //used to mark clique replacement edges may be we can join this with edge type
57
58 NodeArray<DRect> m_cliqueCircleSize; //save the bounding box size of the circular drawing of the clique at center
59
60 NodeArray<DPoint> m_cliqueCirclePos; //save the position of the node in the circular drawing of the clique
61
62public:
64
65 // replace (dense) subgraphs given in list clique by
66 // inserting a center node connected to each node (=>star)
67 // and deleting all edges between nodes in clique
68 // returns center node
69 void replaceByStar(List<List<node>*>& cliques);
70
71 // undo clique replacements
72 void undoStars();
73
74 // boolean switches restore of all hidden edges in single clique call
75 void undoStar(node center, bool restoreAllEdges);
76
77 //returns the size of a circular drawing for a clique around center v
78 DRect cliqueRect(node v) const { return m_cliqueCircleSize[v]; }
79
80 DPoint cliquePos(node v) const { return m_cliqueCirclePos[v]; }
81
82 //compute circle positions for all nodes around center
83 //using the ordering given in this UMLGraph, calls
84 //ccP(List...)
85 //rectMin is a temporary solution until compaction with constraints allows stretching
86 //of rect to clique size, it gives the min(w,h) of the given fixed size rect around the clique
87#if 1
88 void computeCliquePosition(node center, double rectMin);
89#else
90 void computeCliquePosition(node center, double rectMin, const adjEntry& startAdj);
91#endif
92
93 //compute positions for the nodes in adjNodes on a circle
94 //tries to keep the relative placement of the nodes in the clique
95 //rectangle (left, right,...) to avoid clique crossings of outgoing edges
96 void computeCliquePosition(List<node>& adjNodes, node center, double rectMin = -1.0);
97
98 const SListPure<node>& centerNodes() { return m_centerNodes; }
99
100 //default size of inserted clique replacement center nodes
101 void setDefaultCliqueCenterSize(double i) { m_cliqueCenterSize = max(i, 1.0); }
102
103 double getDefaultCliqueCenterSize() { return m_cliqueCenterSize; }
104
107 // TODO: check here how to guarantee that value is defined,
108 // edgearray is only valid if there are cliques replaced
109 return m_replacementEdge[e];
110 }
111
112private:
115};
116
117}
118}
Includes declaration of graph class.
Declaration of singly linked lists and iterators.
Declaration of classes GenericPoint, GenericPolyline, GenericLine, GenericSegment,...
Basic declarations, included by all source files.
Class for adjacency list elements.
Definition Graph_d.h:143
Rectangles with real coordinates.
Definition geometry.h:798
Class for the representation of edges.
Definition Graph_d.h:364
Functionality for temporarily hiding edges in constant time.
Definition Graph_d.h:1222
Stores additional attributes of a graph (like layout information).
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
Singly linked lists.
Definition SList.h:191
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition Graph_d.h:717
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition Graph_d.h:659
CliqueReplacer(GraphAttributes &ga, Graph &G)
void computeCliquePosition(node center, double rectMin)
void undoStar(node center, bool restoreAllEdges)
const SListPure< node > & centerNodes()
node replaceByStar(List< node > &clique, NodeArray< int > &cliqueNum)
bool isReplacement(edge e)
returns true if edge was inserted during clique replacement
void replaceByStar(List< List< node > * > &cliques)
void computeCliquePosition(List< node > &adjNodes, node center, double rectMin=-1.0)
#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.