Open
Graph Drawing
Framework

 v. 2025.10-dev (Foxglove)
 

Loading...
Searching...
No Matches
GraphAttributes.h
Go to the documentation of this file.
1
36#pragma once
37
38#include <ogdf/basic/Graph.h>
40#include <ogdf/basic/basic.h>
41#include <ogdf/basic/geometry.h>
42#include <ogdf/basic/graphics.h>
44
45#include <cstdint>
46#include <string>
47
48namespace ogdf {
49template<class E>
50class List;
51
53
73protected:
74 const Graph* m_pGraph;
75
77
78 // graphical representation of nodes
92
93 // other node attributes
97
98 // graphical representation of edges
103
104 // other edge attributes
109
111
112public:
117
119 static const long nodeGraphics;
120
122 static const long edgeGraphics;
123
125 static const long edgeIntWeight;
126
128 static const long edgeDoubleWeight;
129
131 static const long edgeLabel;
132
134 static const long nodeLabel;
135
137 static const long edgeType;
138
140 static const long nodeType;
141
143 static const long nodeId;
144
146 static const long edgeArrow;
147
149 static const long edgeStyle;
150
153 static const long nodeStyle;
154
156 static const long nodeTemplate;
157
160 static const long edgeSubGraphs;
161
163 static const long nodeWeight;
164
166 static const long threeD;
167
169 static const long nodeLabelPosition;
170
172 static const long all;
173
175
180
182
186
188
192 explicit GraphAttributes(const Graph& G, long attr = nodeGraphics | edgeGraphics);
193
194 virtual ~GraphAttributes() = default;
195
197 long attributes() const { return m_attributes; }
198
200 inline bool has(long attr) const { return (m_attributes & attr) == attr; }
201
203
210 virtual void init(const Graph& G, long attr);
211
214 void init(long attr);
215
217 void addAttributes(long attr);
218
220 void destroyAttributes(long attr);
221
223 const Graph& constGraph() const { return *m_pGraph; }
224
226
230
232 bool directed() const { return m_directed; }
233
235 bool& directed() { return m_directed; }
236
238
242
244
247 double x(node v) const {
248 OGDF_ASSERT(has(nodeGraphics));
249 return m_x[v];
250 }
251
253
256 double& x(node v) {
257 OGDF_ASSERT(has(nodeGraphics));
258 return m_x[v];
259 }
260
262
265 double y(node v) const {
266 OGDF_ASSERT(has(nodeGraphics));
267 return m_y[v];
268 }
269
271
274 double& y(node v) {
275 OGDF_ASSERT(has(nodeGraphics));
276 return m_y[v];
277 }
278
280
283 double z(node v) const {
284 OGDF_ASSERT(has(threeD));
285 return m_z[v];
286 }
287
289
292 double& z(node v) {
293 OGDF_ASSERT(has(threeD));
294 return m_z[v];
295 }
296
298
301 double xLabel(node v) const {
302 OGDF_ASSERT(has(nodeLabelPosition));
303 return m_nodeLabelPosX[v];
304 }
305
307
310 double& xLabel(node v) {
311 OGDF_ASSERT(has(nodeLabelPosition));
312 return m_nodeLabelPosX[v];
313 }
314
316
319 double yLabel(node v) const {
320 OGDF_ASSERT(has(nodeLabelPosition));
321 return m_nodeLabelPosY[v];
322 }
323
325
328 double& yLabel(node v) {
329 OGDF_ASSERT(has(nodeLabelPosition));
330 return m_nodeLabelPosY[v];
331 }
332
334
337 double zLabel(node v) const {
338 OGDF_ASSERT(has(nodeLabelPosition));
339 OGDF_ASSERT(has(threeD));
340 return m_nodeLabelPosZ[v];
341 }
342
344
347 double& zLabel(node v) {
348 OGDF_ASSERT(has(nodeLabelPosition));
349 OGDF_ASSERT(has(threeD));
350 return m_nodeLabelPosZ[v];
351 }
352
354
357 double width(node v) const {
358 OGDF_ASSERT(has(nodeGraphics));
359 return m_width[v];
360 }
361
363
366 double& width(node v) {
367 OGDF_ASSERT(has(nodeGraphics));
368 return m_width[v];
369 }
370
372
375 const NodeArray<double>& width() const {
376 OGDF_ASSERT(has(nodeGraphics));
377 return m_width;
378 }
379
381
385 OGDF_ASSERT(has(nodeGraphics));
386 return m_width;
387 }
388
390
393 double height(node v) const {
394 OGDF_ASSERT(has(nodeGraphics));
395 return m_height[v];
396 }
397
399
402 double& height(node v) {
403 OGDF_ASSERT(has(nodeGraphics));
404 return m_height[v];
405 }
406
408
411 const NodeArray<double>& height() const {
412 OGDF_ASSERT(has(nodeGraphics));
413 return m_height;
414 }
415
417
421 OGDF_ASSERT(has(nodeGraphics));
422 return m_height;
423 }
424
426
429 Shape shape(node v) const {
430 OGDF_ASSERT(has(nodeGraphics));
431 return m_nodeShape[v];
432 }
433
435
439 OGDF_ASSERT(has(nodeGraphics));
440 return m_nodeShape[v];
441 }
442
444
448 OGDF_ASSERT(has(nodeStyle));
449 return m_nodeStroke[v].m_type;
450 }
451
453
457 OGDF_ASSERT(has(nodeStyle));
458 return m_nodeStroke[v].m_type;
459 }
460
462
465 const Color& strokeColor(node v) const {
466 OGDF_ASSERT(has(nodeStyle));
467 return m_nodeStroke[v].m_color;
468 }
469
471
475 OGDF_ASSERT(has(nodeStyle));
476 return m_nodeStroke[v].m_color;
477 }
478
480
483 float strokeWidth(node v) const {
484 OGDF_ASSERT(has(nodeStyle));
485 return m_nodeStroke[v].m_width;
486 }
487
489
492 float& strokeWidth(node v) {
493 OGDF_ASSERT(has(nodeStyle));
494 return m_nodeStroke[v].m_width;
495 }
496
498
502 OGDF_ASSERT(has(nodeStyle));
503 return m_nodeFill[v].m_pattern;
504 }
505
507
511 OGDF_ASSERT(has(nodeStyle));
512 return m_nodeFill[v].m_pattern;
513 }
514
516
519 const Color& fillColor(node v) const {
520 OGDF_ASSERT(has(nodeStyle));
521 return m_nodeFill[v].m_color;
522 }
523
525
529 OGDF_ASSERT(has(nodeStyle));
530 return m_nodeFill[v].m_color;
531 }
532
534
537 const Color& fillBgColor(node v) const {
538 OGDF_ASSERT(has(nodeStyle));
539 return m_nodeFill[v].m_bgColor;
540 }
541
543
547 OGDF_ASSERT(has(nodeStyle));
548 return m_nodeFill[v].m_bgColor;
549 }
550
552
555 const string& label(node v) const {
556 OGDF_ASSERT(has(nodeLabel));
557 return m_nodeLabel[v];
558 }
559
561
564 string& label(node v) {
565 OGDF_ASSERT(has(nodeLabel));
566 return m_nodeLabel[v];
567 }
568
570
573 const string& templateNode(node v) const {
574 OGDF_ASSERT(has(nodeTemplate));
575 return m_nodeTemplate[v];
576 }
577
579
582 string& templateNode(node v) {
583 OGDF_ASSERT(has(nodeTemplate));
584 return m_nodeTemplate[v];
585 }
586
588
591 int weight(node v) const {
592 OGDF_ASSERT(has(nodeWeight));
593 return m_nodeIntWeight[v];
594 }
595
597
600 int& weight(node v) {
601 OGDF_ASSERT(has(nodeWeight));
602 return m_nodeIntWeight[v];
603 }
604
606
610 OGDF_ASSERT(has(nodeType));
611 return m_vType.valid() ? m_vType[v] : Graph::NodeType::vertex;
612 }
613
615
619 OGDF_ASSERT(has(nodeType));
620 return m_vType[v];
621 }
622
624
629 int idNode(node v) const {
630 OGDF_ASSERT(has(nodeId));
631 return m_nodeId[v] == -1 ? v->index() : m_nodeId[v];
632 }
633
635
640 int& idNode(node v) {
641 OGDF_ASSERT(has(nodeId));
642 if (m_nodeId[v] == -1) {
643 m_nodeId[v] = v->index();
644 }
645 return m_nodeId[v];
646 }
647
649
653
654
656
664 const DPolyline& bends(edge e) const {
665 OGDF_ASSERT(has(edgeGraphics));
666 return m_bends[e];
667 }
668
670
676 OGDF_ASSERT(has(edgeGraphics));
677 return m_bends[e];
678 }
679
681
685 OGDF_ASSERT(has(edgeArrow));
686 return m_edgeArrow[e];
687 }
688
690
694 OGDF_ASSERT(has(edgeArrow));
695 return m_edgeArrow[e];
696 }
697
699
705 if (!has(edgeArrow) || arrowType(e) == EdgeArrow::Undefined) {
706 if (has(edgeType)) {
707 if (type(e) == Graph::EdgeType::generalization) {
708 return EdgeArrow::Last;
709 } else {
710 return EdgeArrow::None;
711 }
712 } else {
713 if (directed()) {
714 return EdgeArrow::Last;
715 } else {
716 return EdgeArrow::None;
717 }
718 }
719 } else {
720 return arrowType(e);
721 }
722 }
723
725
729 OGDF_ASSERT(has(edgeStyle));
730 return m_edgeStroke[e].m_type;
731 }
732
734
738 OGDF_ASSERT(has(edgeStyle));
739 return m_edgeStroke[e].m_type;
740 }
741
743
746 const Color& strokeColor(edge e) const {
747 OGDF_ASSERT(has(edgeStyle));
748 return m_edgeStroke[e].m_color;
749 }
750
752
756 OGDF_ASSERT(has(edgeStyle));
757 return m_edgeStroke[e].m_color;
758 }
759
761
764 float strokeWidth(edge e) const {
765 OGDF_ASSERT(has(edgeStyle));
766 return m_edgeStroke[e].m_width;
767 }
768
770
773 float& strokeWidth(edge e) {
774 OGDF_ASSERT(has(edgeStyle));
775 return m_edgeStroke[e].m_width;
776 }
777
779
782 const string& label(edge e) const {
783 OGDF_ASSERT(has(edgeLabel));
784 return m_edgeLabel[e];
785 }
786
788
791 string& label(edge e) {
792 OGDF_ASSERT(has(edgeLabel));
793 return m_edgeLabel[e];
794 }
795
797
800 int intWeight(edge e) const {
801 OGDF_ASSERT(has(edgeIntWeight));
802 return m_intWeight[e];
803 }
804
806
809 int& intWeight(edge e) {
810 OGDF_ASSERT(has(edgeIntWeight));
811 return m_intWeight[e];
812 }
813
815
818 double doubleWeight(edge e) const {
819 OGDF_ASSERT(has(edgeDoubleWeight));
820 return m_doubleWeight[e];
821 }
822
824
827 double& doubleWeight(edge e) {
828 OGDF_ASSERT(has(edgeDoubleWeight));
829 return m_doubleWeight[e];
830 }
831
833
837 OGDF_ASSERT(has(edgeType));
838 return m_eType.valid() ? m_eType[e] : Graph::EdgeType::association;
839 }
840
842
846 OGDF_ASSERT(has(edgeType));
847 return m_eType[e];
848 }
849
851
854 uint32_t subGraphBits(edge e) const {
855 OGDF_ASSERT(has(edgeSubGraphs));
856 return m_subGraph[e];
857 }
858
860
863 uint32_t& subGraphBits(edge e) {
864 OGDF_ASSERT(has(edgeSubGraphs));
865 return m_subGraph[e];
866 }
867
869
872 bool inSubGraph(edge e, int n) const {
873 OGDF_ASSERT(has(edgeSubGraphs));
874 OGDF_ASSERT(n >= 0);
875 OGDF_ASSERT(n < 32);
876 return (m_subGraph[e] & (1 << n)) != 0;
877 }
878
880
883 void addSubGraph(edge e, int n) {
884 OGDF_ASSERT(has(edgeSubGraphs));
885 OGDF_ASSERT(n >= 0);
886 OGDF_ASSERT(n < 32);
887 m_subGraph[e] |= (1 << n);
888 }
889
891
894 void removeSubGraph(edge e, int n) {
895 OGDF_ASSERT(has(edgeSubGraphs));
896 OGDF_ASSERT(n >= 0);
897 OGDF_ASSERT(n < 32);
898 m_subGraph[e] &= ~(1 << n);
899 }
900
902
906
908
917 virtual void scale(double sx, double sy, bool scaleNodes = true);
918
920
928 virtual void scale(double s, bool scaleNodes = true) { scale(s, s, scaleNodes); }
929
931
935 virtual void translate(double dx, double dy);
936
938 virtual void translateToNonNeg();
939
941
945 virtual void flipVertical() { flipVertical(boundingBox()); }
946
948
952 virtual void flipVertical(const DRect& box);
953
955
959 virtual void flipHorizontal() { flipHorizontal(boundingBox()); }
960
962
966 virtual void flipHorizontal(const DRect& box);
967
969
979 virtual void scaleAndTranslate(double sx, double sy, double dx, double dy,
980 bool scaleNodes = true);
981
983
992 virtual void scaleAndTranslate(double s, double dx, double dy, bool scaleNodes = true) {
993 scaleAndTranslate(s, s, dx, dy, scaleNodes);
994 }
995
997 virtual void rotateRight90();
998
1000 virtual void rotateLeft90();
1001
1003
1007
1009 template<typename T>
1011
1013 template<typename T>
1015
1017
1024 template<typename T>
1026 OGDF_ASSERT(attribute != nullptr);
1027 if (constGraph().numberOfNodes() == 0) {
1028 return true;
1029 }
1030
1031 T firstAttr = (this->*attribute)(*constGraph().nodes.begin());
1032 for (node n : constGraph().nodes) {
1033 if ((this->*attribute)(n) != firstAttr) {
1034 return false;
1035 }
1036 }
1037 return true;
1038 }
1039
1041
1048 template<typename T>
1050 OGDF_ASSERT(attribute != nullptr);
1051 if (constGraph().numberOfEdges() == 0) {
1052 return true;
1053 }
1054
1055 T firstAttr = (this->*attribute)(*constGraph().edges.begin());
1056 for (edge e : constGraph().edges) {
1057 if ((this->*attribute)(e) != firstAttr) {
1058 return false;
1059 }
1060 }
1061 return true;
1062 }
1063
1073 bool isUniform(long attributes) const;
1074
1076 inline DPoint point(node v) const { return DPoint(m_x[v], m_y[v]); }
1077
1079
1092
1094
1107 void transferToCopy(GraphAttributes& copyAttr) const;
1108
1110
1113 virtual DRect boundingBox() const;
1114
1116
1121 template<class Rectangle = DRect>
1122 void nodeBoundingBoxes(NodeArray<Rectangle>& boundingBoxes) const {
1123 for (node v : constGraph().nodes) {
1124 double vHalfWidth = width(v) / 2.0;
1125 double vHalfHeight = height(v) / 2.0;
1126 boundingBoxes[v] = Rectangle(x(v) - vHalfWidth, y(v) - vHalfHeight, x(v) + vHalfWidth,
1127 y(v) + vHalfHeight);
1128 }
1129 }
1130
1132
1135 void setAllWidth(double w);
1136
1138
1141 void setAllHeight(double h);
1142
1144
1148
1150
1160
1162
1173 void addNodeCenter2Bends(int mode = 1);
1174
1176
1184 bool isAssociationClass(node v) const { return type(v) == Graph::NodeType::associationClass; }
1185
1187
1195 int hierarchyList(List<List<node>*>& list) const;
1196
1198
1206 int hierarchyList(List<List<edge>*>& list) const;
1207
1209
1210private:
1212 void copyNodeAttributes(GraphAttributes& toAttr, node vFrom, node vTo, long attrs) const;
1213
1215 void copyEdgeAttributes(GraphAttributes& toAttr, edge eFrom, edge eTo, long attrs) const;
1216};
1217
1218}
Includes declaration of graph class.
Decralation of GraphElement and GraphList classes.
Declaration of classes GenericPoint, GenericPolyline, GenericLine, GenericSegment,...
Basic declarations, included by all source files.
Colors represented as RGBA values.
Definition graphics.h:164
Rectangles with real coordinates.
Definition geometry.h:798
Class for the representation of edges.
Definition Graph_d.h:364
Polylines with PointType points.
Definition geometry.h:261
Stores additional attributes of a graph (like layout information).
bool isUniform(long attributes) const
Check whether all of the attributes associated with the bitflags in attributes (that are also enabled...
NodeArray< double > m_z
z-coordinate of a node
Graph::EdgeType type(edge e) const
Returns the type of edge e.
int hierarchyList(List< List< edge > * > &list) const
Returns a list of all inheritance hierarchies in the graph.
NodeArray< double > m_nodeLabelPosZ
z-coordinate of a node label
DPolyline & bends(edge e)
Returns the list of bend points of edge e.
static const long edgeLabel
Corresponds to edge attribute label(edge).
EdgeArrow arrowType(edge e) const
Returns the arrow type of edge e.
EdgeArray< EdgeArrow > m_edgeArrow
arrow type of an edge
EdgeArray< double > m_doubleWeight
(real number) weight of an edge
void init(long attr)
Re-initializes the graph attributes while maintaining the associated graph.
string & label(node v)
Returns the label of node v.
void copyNodeAttributes(GraphAttributes &toAttr, node vFrom, node vTo, long attrs) const
Copies all attributes attrs of vFrom to toAttr for vTo.
EdgeArray< DPolyline > m_bends
list of bend points of an edge
static const long edgeArrow
Corresponds to edge attribute arrowType(edge).
EdgeArray< uint32_t > m_subGraph
is element of subgraphs given by bitvector
NodeArray< string > m_nodeTemplate
name of template of a node
NodeArray< Fill > m_nodeFill
fill of a node
int weight(node v) const
Returns the weight of node v.
bool isUniformForNodes(NodeAttributeGetter< T > attribute) const
Checks whether a certain attribute has the same value for all nodes.
Color & fillColor(node v)
Returns the fill color of node v.
T(GraphAttributes::*)(node) const NodeAttributeGetter
type of node attribute getter functions
const Color & strokeColor(edge e) const
Returns the stroke color of edge e.
const NodeArray< double > & height() const
Returns a reference to the node array m_height.
NodeArray< Graph::NodeType > m_vType
type (vertex, dummy, generalizationMerger)
StrokeType strokeType(edge e) const
Returns the stroke type of edge e.
void removeUnnecessaryBendsHV()
Removes unnecessary bend points in orthogonal segements.
Graph::NodeType & type(node v)
Returns the type of node v.
virtual void scaleAndTranslate(double s, double dx, double dy, bool scaleNodes=true)
Scales the layout by s and then translates it by (dx,dy).
bool isAssociationClass(node v) const
Returns true iff v represents an association class.
void setAllWidth(double w)
Sets the width of all nodes to w.
double y(node v) const
Returns the y-coordinate of node v.
virtual void rotateLeft90()
Rotates the layout by 90 degree (in counter-clockwise direction) around the origin.
double & zLabel(node v)
Returns the label z-coordinate of node v.
int intWeight(edge e) const
Returns the (integer) weight of edge e.
double height(node v) const
Returns the height of the bounding box of node v.
void transferToCopy(GraphAttributes &copyAttr) const
Copies attributes of this to copyAttr.
bool directed() const
Returns if the graph is directed.
const string & label(node v) const
Returns the label of node v.
virtual void rotateRight90()
Rotates the layout by 90 degree (in clockwise direction) around the origin.
FillPattern & fillPattern(node v)
Returns the fill pattern of node v.
double x(node v) const
Returns the x-coordinate of node v.
EdgeArray< Graph::EdgeType > m_eType
type of an edge (association or generalization)
const Color & fillBgColor(node v) const
Returns the background color of fill patterns for node v.
const Graph * m_pGraph
associated graph
void addSubGraph(edge e, int n)
Adds edge e to basic graph n.
virtual void flipHorizontal()
Flips the layout horizontally within its bounding box.
virtual void flipHorizontal(const DRect &box)
Flips the (whole) layout horizontally such that the part in box remains in this area.
void destroyAttributes(long attr)
Disables attributes specified by attr and releases available memory.
static const long edgeStyle
Corresponds to edge attributes strokeColor(edge), strokeType(edge), and strokeWidth(edge).
NodeArray< double > m_x
x-coordinate of a node
const Graph & constGraph() const
Returns a reference to the associated graph.
virtual void init(const Graph &G, long attr)
Initializes the graph attributes for graph G.
virtual void scaleAndTranslate(double sx, double sy, double dx, double dy, bool scaleNodes=true)
Scales the layout by (sx,sy) and then translates it by (dx,dy).
const string & label(edge e) const
Returns the label of edge e.
double width(node v) const
Returns the width of the bounding box of node v.
static const long threeD
Corresponds to node attribute z(node). Note that all methods work on 2D coordinates only.
double doubleWeight(edge e) const
Returns the (real number) weight of edge e.
NodeArray< double > m_height
height of a nodes's bounding box
int & idNode(node v)
Returns the user ID of node v.
float & strokeWidth(node v)
Returns the stroke width of node v.
double & z(node v)
Returns the z-coordinate of node v.
virtual void translate(double dx, double dy)
Translates the layout by (dx,dy).
static const long all
Enables all available flags.
void nodeBoundingBoxes(NodeArray< Rectangle > &boundingBoxes) const
Computes the bounding rectangle for each node.
static const long nodeLabelPosition
Corresponds to node attributes xLabel(node), yLabel(node), and zLabel(node).
virtual DRect boundingBox() const
Returns the bounding box of the graph, also respects node sizes.
EdgeArray< int > m_intWeight
(integer) weight of an edge
NodeArray< int > m_nodeId
user ID of a node
Graph::EdgeType & type(edge e)
Returns the type of edge e.
EdgeArrow effectiveArrowType(edge e) const
Returns the effective arrow type of edge e, i.e., what should be used for displaying.
uint32_t subGraphBits(edge e) const
Returns the edgesubgraph value of an edge e.
Graph::NodeType type(node v) const
Returns the type of node v.
GraphAttributes(const Graph &G, long attr=nodeGraphics|edgeGraphics)
Constructs graph attributes associated with the graph G.
float strokeWidth(edge e) const
Returns the stroke width of edge e.
double & x(node v)
Returns the x-coordinate of node v.
StrokeType strokeType(node v) const
Returns the stroke type of node v.
int & intWeight(edge e)
Returns the (integer) weight of edge e.
NodeArray< double > m_y
y-coordinate of a node
EdgeArrow & arrowType(edge e)
Returns the arrow type of edge e.
long attributes() const
Returns currently accessible attributes.
float & strokeWidth(edge e)
Returns the stroke width of edge e.
bool & directed()
Returns if the graph is directed.
double xLabel(node v) const
Returns the label x-coordinate of node v.
virtual void flipVertical(const DRect &box)
Flips the (whole) layout vertically such that the part in box remains in this area.
Color & strokeColor(edge e)
Returns the stroke color of edge e.
bool inSubGraph(edge e, int n) const
Checks whether edge e belongs to basic graph n.
double & yLabel(node v)
Returns the label y-coordinate of node v.
NodeArray< double > m_nodeLabelPosX
x-coordinate of a node label
static const long nodeLabel
Corresponds to node attribute label(node).
double & y(node v)
Returns the y-coordinate of node v.
double yLabel(node v) const
Returns the label y-coordinate of node v.
Color & strokeColor(node v)
Returns the stroke color of node v.
double & height(node v)
Returns the height of the bounding box of node v.
static const long nodeTemplate
Corresponds to node attribute templateNode(node).
static const long nodeId
Corresponds to node attribute idNode(node).
int idNode(node v) const
Returns the user ID of node v.
int & weight(node v)
Returns the weight of node v.
void transferToOriginal(GraphAttributes &origAttr) const
Copies attributes of this to origAttr.
void setAllHeight(double h)
Sets the height of all nodes to h.
static const long edgeDoubleWeight
Corresponds to edge attribute doubleWeight(edge).
EdgeArray< string > m_edgeLabel
label of an edge
static const long edgeType
Corresponds to edge attribute type(edge).
FillPattern fillPattern(node v) const
Returns the fill pattern of node v.
void copyEdgeAttributes(GraphAttributes &toAttr, edge eFrom, edge eTo, long attrs) const
Copies all attributes attrs except bends (!) of eFrom to toAttr for eTo.
static const long nodeWeight
Corresponds to node attribute weight(node).
const Color & fillColor(node v) const
Returns the fill color of node v.
void addAttributes(long attr)
Enables attributes specified by attr and allocates required memory.
double zLabel(node v) const
Returns the label z-coordinate of node v.
NodeArray< double > m_nodeLabelPosY
y-coordinate of a node label
void removeSubGraph(edge e, int n)
Removes edge e from basic graph n.
void addNodeCenter2Bends(int mode=1)
Adds additional bend points to all edges for connecting their endpoints.
const NodeArray< double > & width() const
Returns a reference to the node array m_width.
const Color & strokeColor(node v) const
Returns the stroke color of node v.
Shape shape(node v) const
Returns the shape type of node v.
bool isUniformForEdges(EdgeAttributeGetter< T > attribute) const
Checks whether a certain attribute has the same value for all edges.
float strokeWidth(node v) const
Returns the stroke width of node v.
NodeArray< Stroke > m_nodeStroke
stroke of a node
void clearAllBends()
Removes all edge bends.
StrokeType & strokeType(node v)
Returns the stroke type of node v.
NodeArray< double > m_width
width of a node's bounding box
long m_attributes
bit vector of currently used attributes
static const long nodeStyle
Corresponds to node attributes strokeColor(node), strokeType(node), strokeWidth(node),...
double & width(node v)
Returns the width of the bounding box of node v.
NodeArray< double > & height()
Returns a reference to the node array m_height.
StrokeType & strokeType(edge e)
Returns the stroke type of edge e.
bool m_directed
whether or not the graph is directed
NodeArray< double > & width()
Returns a reference to the node array #m_width.
int hierarchyList(List< List< node > * > &list) const
Returns a list of all inheritance hierarchies in the graph.
double & doubleWeight(edge e)
Returns the (real number) weight of edge e.
Shape & shape(node v)
Returns the shape type of node v.
static const long edgeSubGraphs
Corresponds to edge attributes modified by addSubGraph(edge, int), inSubGraph(edge,...
const string & templateNode(node v) const
Returns the template name of node v.
const DPolyline & bends(edge e) const
Returns the list of bend points of edge e.
virtual void scale(double sx, double sy, bool scaleNodes=true)
Scales the layout by (sx,sy).
virtual ~GraphAttributes()=default
virtual void flipVertical()
Flips the layout vertically within its bounding box.
static const long nodeType
Corresponds to node attribute type(node).
static const long edgeGraphics
Corresponds to edge attribute bends(edge).
DPoint point(node v) const
Returns a DPoint corresponding to the x- and y-coordinates of v.
NodeArray< Shape > m_nodeShape
shape of a node
virtual void translateToNonNeg()
Translates the layout such that the lower left corner is at (0,0).
bool has(long attr) const
Returns true iff all attributes in attr are available.
GraphAttributes()
Constructs graph attributes for no associated graph (default constructor).
static const long edgeIntWeight
Corresponds to edge attribute intWeight(edge).
double & xLabel(node v)
Returns the label x-coordinate of node v.
NodeArray< int > m_nodeIntWeight
(integer) weight of a node
NodeArray< string > m_nodeLabel
label of a node
string & label(edge e)
Returns the label of edge e.
static const long nodeGraphics
Corresponds to node attributes x(node), y(node), width(node), height(node), and shape(node).
Color & fillBgColor(node v)
Returns the background color of fill patterns for node v.
string & templateNode(node v)
Returns the template name of node v.
T(GraphAttributes::*)(edge) const EdgeAttributeGetter
type of edge attribute getter functions
uint32_t & subGraphBits(edge e)
Returns the edgesubgraph value of an edge e.
double z(node v) const
Returns the z-coordinate of node v.
EdgeArray< Stroke > m_edgeStroke
stroke of an edge
virtual void scale(double s, bool scaleNodes=true)
Scales the layout by s.
Data type for general directed graphs (adjacency list representation).
Definition Graph_d.h:866
NodeType
The type of nodes.
Definition Graph_d.h:909
EdgeType
The type of edges (only used in derived classes).
Definition Graph_d.h:906
Doubly linked lists (maintaining the length of the list).
Definition List.h:1451
Class for the representation of nodes.
Definition Graph_d.h:241
int index() const
Returns the (unique) node index.
Definition Graph_d.h:275
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
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF dynamic library (shared object / DLL),...
Definition config.h:118
Decralation of graph iterators.
Declaration of basic types for graphics.
FillPattern
Fill patterns.
Definition graphics.h:86
StrokeType
Line types of strokes.
Definition graphics.h:50
Shape
Types for node shapes.
Definition graphics.h:120
EdgeArrow
Types for edge arrows.
Definition graphics.h:145
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition basic.h:52
The namespace for all OGDF objects.
long long nodeType
long long edgeType