Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

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 
41 namespace ogdf {
42 class GraphAttributes;
43 template<class E>
44 class List;
45 
46 namespace 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 
62 public:
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 
106  bool isReplacement(edge e) {
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 
112 private:
113  node replaceByStar(List<node>& clique, NodeArray<int>& cliqueNum);
114  DRect circularBound(node center);
115 };
116 
117 }
118 }
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
ogdf::GraphAttributes
Stores additional attributes of a graph (like layout information).
Definition: GraphAttributes.h:72
ogdf::planarization_layout::CliqueReplacer::m_centerNodes
SListPure< node > m_centerNodes
Definition: CliqueReplacer.h:54
Graph.h
Includes declaration of graph class.
ogdf::GenericPoint
Parameterized base class for points.
Definition: geometry.h:81
ogdf::planarization_layout::CliqueReplacer::getDefaultCliqueCenterSize
double getDefaultCliqueCenterSize()
Definition: CliqueReplacer.h:103
geometry.h
Declaration of classes GenericPoint, GenericPolyline, GenericLine, GenericSegment,...
ogdf::planarization_layout::CliqueReplacer::setDefaultCliqueCenterSize
void setDefaultCliqueCenterSize(double i)
Definition: CliqueReplacer.h:101
ogdf::planarization_layout::CliqueReplacer
Definition: CliqueReplacer.h:48
ogdf::Graph::HiddenEdgeSet
Functionality for temporarily hiding edges in constant time.
Definition: Graph_d.h:1224
ogdf::planarization_layout::CliqueReplacer::centerNodes
const SListPure< node > & centerNodes()
Definition: CliqueReplacer.h:98
ogdf::planarization_layout::CliqueReplacer::m_cliqueCircleSize
NodeArray< DRect > m_cliqueCircleSize
Definition: CliqueReplacer.h:58
ogdf::planarization_layout::CliqueReplacer::m_G
Graph & m_G
Definition: CliqueReplacer.h:49
ogdf::AdjElement
Class for adjacency list elements.
Definition: Graph_d.h:142
ogdf::planarization_layout::CliqueReplacer::m_cliqueCenterSize
double m_cliqueCenterSize
Definition: CliqueReplacer.h:53
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:106
ogdf::DRect
Rectangles with real coordinates.
Definition: geometry.h:798
ogdf::SListPure
Singly linked lists.
Definition: SList.h:52
ogdf::planarization_layout::CliqueReplacer::m_hiddenEdges
Graph::HiddenEdgeSet m_hiddenEdges
Definition: CliqueReplacer.h:51
ogdf::List
Doubly linked lists (maintaining the length of the list).
Definition: DfsMakeBiconnected.h:40
ogdf::internal::GraphRegisteredArray
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition: Graph_d.h:658
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:869
ogdf::planarization_layout::CliqueReplacer::m_replacementEdge
EdgeArray< bool > m_replacementEdge
Definition: CliqueReplacer.h:56
ogdf::planarization_layout::CliqueReplacer::m_ga
GraphAttributes & m_ga
Definition: CliqueReplacer.h:50
ogdf::planarization_layout::CliqueReplacer::m_cliqueCirclePos
NodeArray< DPoint > m_cliqueCirclePos
Definition: CliqueReplacer.h:60
basic.h
Basic declarations, included by all source files.
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:78
ogdf::planarization_layout::CliqueReplacer::cliquePos
DPoint cliquePos(node v) const
Definition: CliqueReplacer.h:80
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:363
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:240
ogdf::internal::EdgeArrayBase2
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition: Graph_d.h:716