Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

CliqueReplacer.h
Go to the documentation of this file.
1 
32 #pragma once
33 
35 #include <ogdf/basic/SList.h>
36 
37 namespace ogdf {
38 namespace planarization_layout {
39 
44 
45  double m_cliqueCenterSize; //default size of inserted clique replacement center nodes
46  SListPure<node> m_centerNodes; //center nodes introduced at clique replacement
47 
48  EdgeArray<bool> m_replacementEdge; //used to mark clique replacement edges may be we can join this with edge type
49 
50  NodeArray<DRect> m_cliqueCircleSize; //save the bounding box size of the circular drawing of the clique at center
51 
52  NodeArray<DPoint> m_cliqueCirclePos; //save the position of the node in the circular drawing of the clique
53 
54 public:
56 
57  // replace (dense) subgraphs given in list clique by
58  // inserting a center node connected to each node (=>star)
59  // and deleting all edges between nodes in clique
60  // returns center node
61  void replaceByStar(List<List<node>*>& cliques);
62 
63  // undo clique replacements
64  void undoStars();
65 
66  // boolean switches restore of all hidden edges in single clique call
67  void undoStar(node center, bool restoreAllEdges);
68 
69  //returns the size of a circular drawing for a clique around center v
70  DRect cliqueRect(node v) const { return m_cliqueCircleSize[v]; }
71 
72  DPoint cliquePos(node v) const { return m_cliqueCirclePos[v]; }
73 
74  //compute circle positions for all nodes around center
75  //using the ordering given in this UMLGraph, calls
76  //ccP(List...)
77  //rectMin is a temporary solution until compaction with constraints allows stretching
78  //of rect to clique size, it gives the min(w,h) of the given fixed size rect around the clique
79 #if 1
80  void computeCliquePosition(node center, double rectMin);
81 #else
82  void computeCliquePosition(node center, double rectMin, const adjEntry& startAdj);
83 #endif
84 
85  //compute positions for the nodes in adjNodes on a circle
86  //tries to keep the relative placement of the nodes in the clique
87  //rectangle (left, right,...) to avoid clique crossings of outgoing edges
88  void computeCliquePosition(List<node>& adjNodes, node center, double rectMin = -1.0);
89 
90  const SListPure<node>& centerNodes() { return m_centerNodes; }
91 
92  //default size of inserted clique replacement center nodes
93  void setDefaultCliqueCenterSize(double i) { m_cliqueCenterSize = max(i, 1.0); }
94 
95  double getDefaultCliqueCenterSize() { return m_cliqueCenterSize; }
96 
98  bool isReplacement(edge e) {
99  // TODO: check here how to guarantee that value is defined,
100  // edgearray is only valid if there are cliques replaced
101  return m_replacementEdge[e];
102  }
103 
104 private:
105  node replaceByStar(List<node>& clique, NodeArray<int>& cliqueNum);
106  DRect circularBound(node center);
107 };
108 
109 }
110 }
ogdf
The namespace for all OGDF objects.
Definition: AugmentationModule.h:36
ogdf::GraphAttributes
Stores additional attributes of a graph (like layout information).
Definition: GraphAttributes.h:66
GraphAttributes.h
Declaration of class GraphAttributes which extends a Graph by additional attributes.
ogdf::planarization_layout::CliqueReplacer::m_centerNodes
SListPure< node > m_centerNodes
Definition: CliqueReplacer.h:46
ogdf::GenericPoint
Parameterized base class for points.
Definition: geometry.h:74
ogdf::planarization_layout::CliqueReplacer::getDefaultCliqueCenterSize
double getDefaultCliqueCenterSize()
Definition: CliqueReplacer.h:95
ogdf::planarization_layout::CliqueReplacer::setDefaultCliqueCenterSize
void setDefaultCliqueCenterSize(double i)
Definition: CliqueReplacer.h:93
ogdf::planarization_layout::CliqueReplacer
Definition: CliqueReplacer.h:40
ogdf::Graph::HiddenEdgeSet
Functionality for temporarily hiding edges in constant time.
Definition: Graph_d.h:1216
ogdf::planarization_layout::CliqueReplacer::centerNodes
const SListPure< node > & centerNodes()
Definition: CliqueReplacer.h:90
ogdf::planarization_layout::CliqueReplacer::m_cliqueCircleSize
NodeArray< DRect > m_cliqueCircleSize
Definition: CliqueReplacer.h:50
ogdf::planarization_layout::CliqueReplacer::m_G
Graph & m_G
Definition: CliqueReplacer.h:41
ogdf::AdjElement
Class for adjacency list elements.
Definition: Graph_d.h:135
ogdf::planarization_layout::CliqueReplacer::m_cliqueCenterSize
double m_cliqueCenterSize
Definition: CliqueReplacer.h:45
SList.h
Declaration of singly linked lists and iterators.
ogdf::planarization_layout::CliqueReplacer::isReplacement
bool isReplacement(edge e)
returns true if edge was inserted during clique replacement
Definition: CliqueReplacer.h:98
ogdf::DRect
Rectangles with real coordinates.
Definition: geometry.h:791
ogdf::SListPure
Singly linked lists.
Definition: SList.h:39
ogdf::planarization_layout::CliqueReplacer::m_hiddenEdges
Graph::HiddenEdgeSet m_hiddenEdges
Definition: CliqueReplacer.h:43
ogdf::List
Doubly linked lists (maintaining the length of the list).
Definition: List.h:42
ogdf::internal::GraphRegisteredArray
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition: Graph_d.h:651
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:862
ogdf::planarization_layout::CliqueReplacer::m_replacementEdge
EdgeArray< bool > m_replacementEdge
Definition: CliqueReplacer.h:48
ogdf::planarization_layout::CliqueReplacer::m_ga
GraphAttributes & m_ga
Definition: CliqueReplacer.h:42
ogdf::planarization_layout::CliqueReplacer::m_cliqueCirclePos
NodeArray< DPoint > m_cliqueCirclePos
Definition: CliqueReplacer.h:52
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
ogdf::planarization_layout::CliqueReplacer::cliqueRect
DRect cliqueRect(node v) const
Definition: CliqueReplacer.h:70
ogdf::planarization_layout::CliqueReplacer::cliquePos
DPoint cliquePos(node v) const
Definition: CliqueReplacer.h:72
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:356
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:233
ogdf::internal::EdgeArrayBase2
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition: Graph_d.h:709