File: GraphAttributes.h

package info (click to toggle)
bandage 0.9.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 15,684 kB
  • sloc: cpp: 45,359; sh: 491; makefile: 12
file content (863 lines) | stat: -rw-r--r-- 24,324 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
/*
 * $Revision: 2585 $
 *
 * last checkin:
 *   $Author: klein $
 *   $Date: 2012-07-12 03:46:50 +0200 (Do, 12. Jul 2012) $
 ***************************************************************/

/** \file
 * \brief Declaration of class GraphAttributes which extends a Graph
 *        by additional attributes.
 *
 * \author Carsten Gutwenger
 *         Karsten Klein
 *         Joachim Kupke
 *         Sebastian Leipert
 *
 * \par License:
 * This file is part of the Open Graph Drawing Framework (OGDF).
 *
 * \par
 * Copyright (C)<br>
 * See README.txt in the root directory of the OGDF installation for details.
 *
 * \par
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * Version 2 or 3 as published by the Free Software Foundation;
 * see the file LICENSE.txt included in the packaging of this file
 * for details.
 *
 * \par
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * \par
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 *
 * \see  http://www.gnu.org/copyleft/gpl.html
 ***************************************************************/




#ifdef _MSC_VER
#pragma once
#endif

#ifndef OGDF_ATTRIBUTED_GRAPH_H
#define OGDF_ATTRIBUTED_GRAPH_H

#include "NodeArray.h"
#include "EdgeArray.h"
#include "String.h"
#include "geometry.h"

namespace ogdf {

//---------------------------------------------------------
// GraphAttributes
// graph topology + graphical attributes
//---------------------------------------------------------
//! Stores additional attributes of a graph (like layout information).
/**
 * It is frequently necessary to associate additional attributes with a graph.
 * The class GraphAttributes provides various such attributes and is the
 * central place were such attributes are stored.
 *
 * Attributes are simply stored in node or edge arrays; for memory consumption
 * reasons, only a subset of these arrays is in fact initialized for the graph;
 * non-initialized arrays require only a few bytes of extra memory.
 *
 * Which arrays are initialized is specified by a bit vector; each bit in this
 * bit vector corresponds to one or more attributes. E.g., \a #nodeGraphics
 * corresponds to the attributes \a #m_x, \a #m_y, \a #m_width, and \a #m_height;
 * whereas \a #edgeDoubleWeight only corresponds to the attribute \a #m_doubleWeight.
 *
 * Attributes can be initialized by the constructor GraphAttributes(const Graph &,long)
 * or the function initAttributes(); attributes can also be deinitialized by
 * calling destroyAttributes().
 */

class OGDF_EXPORT GraphAttributes {
public:
	//! Types for edge arrows.
	enum EdgeArrow {
		none, //!< no edge arrows
		last, //!< edge arrow at target node of the edge
		first, //!< edge arrow at source node of the edge
		both, //!< edge arrow at target and source node of the edge
		undefined
	};

	//! Types for line styles.
	/**
	 * The line styles are preliminary the same as in QT.
	 */
	enum EdgeStyle {
		esNoPen = 0, //!< no line
		esSolid = 1, //!< solid line
		esDash = 2, //!< dashed line
		esDot = 3, //!< dotted line
		esDashdot = 4, //!< line style "dash dot dash dot ..."
		esDashdotdot = 5
	//!< line style "dash dot dot dash dot dot ..."
	};

	//! Converts integer \a i to edge style.
	static EdgeStyle intToStyle(int i) {
		switch (i) {
		case 0:
			return esNoPen;
		case 1:
			return esSolid;
		case 2:
			return esDash;
		case 3:
			return esDot;
		case 4:
			return esDashdot;
		case 5:
			return esDashdotdot;
		default:
			return esNoPen;

		}
	}

	//! Types for object brush patterns.
	/**
	 * The brush patterns are currently the same as the GDE project.
	 */
	enum BrushPattern {
		bpNone = 0,
		bpSolid = 1,
		bpDense1 = 2,
		bpDense2 = 3,
		bpDense3 = 4,
		bpDense4 = 5,
		bpDense5 = 6,
		bpDense6 = 7,
		bpDense7 = 8,
		bpHorizontal = 9,
		bpVertical = 10,
		bpCross = 11,
		BackwardDiagonal = 12,
		ForwardDiagonal = 13,
		DiagonalCross = 14
	};

	//! Converts integer \a i to brush pattern.
	static BrushPattern intToPattern(int i) {
		switch (i) {
		case 0:
			return bpNone;
			break;
		case 1:
			return bpSolid;
			break;
		case 2:
			return bpDense1;
			break;
		case 3:
			return bpDense2;
			break;
		case 4:
			return bpDense3;
			break;
		case 5:
			return bpDense4;
			break;
		case 6:
			return bpDense5;
			break;
		case 7:
			return bpDense6;
			break;
		case 8:
			return bpDense7;
			break;
		case 9:
			return bpHorizontal;
			break;
		case 10:
			return bpVertical;
			break;
		case 11:
			return bpCross;
			break;
		case 12:
			return BackwardDiagonal;
			break;
		case 13:
			return ForwardDiagonal;
			break;
		case 14:
			return DiagonalCross;
			break;
		default:
			return bpNone;
			break;
		}
	}

	//! Specifies scaling of images.
	enum ImageStyle {
		FreeScale = 0, FixScale = 1
	};
	//! Specifies image alignment.
	enum ImageAlignment {
		TopLeft = 0, TopCenter, TopRight, CenterLeft, Center, CenterRight, BottomLeft, BottomCenter, BottomRight
	};

	//! Helper function mapping int values to image styles
	static ImageStyle intToImageStyle(int i) {
		switch (i) {
		case 0:
			return FreeScale;
			break;
		case 1:
			return FixScale;
			break;
		default:
			return FreeScale;
		}//switch
	}//intToStyle

	//! Helper function mapping int values to image alignment
	static ImageAlignment intToImageAlignment(int i) {
		switch (i) {
		case 0:
			return TopLeft;
			break;
		case 1:
			return TopCenter;
			break;
		case 2:
			return TopRight;
			break;
		case 3:
			return CenterLeft;
			break;
		case 4:
			return Center;
			break;
		case 5:
			return CenterRight;
			break;
		case 6:
			return BottomLeft;
			break;
		case 7:
			return BottomCenter;
			break;
		case 8:
			return BottomRight;
			break;
		default:
			return TopLeft;
		}//switch
	}//intToAlignment

protected:
	/**
	 * Writes string \a str into a GML file such that line length limits
	 * are respected and characters '\', '"' are correctly escaped.
	 */
	void writeLongString(ostream &os, const String &str) const;

	/* Methods for OGML serialization */

	//! Static helper method for mapping edge styles to ogml.
	static const char * edgeStyleToOGML(const GraphAttributes::EdgeStyle & edgeStyle);

	//! Static helper method for mapping image alignments to ogml.
	static const char * imageAlignmentToOGML(const GraphAttributes::ImageAlignment &imgAlign);

	//! Static helper method for mapping image style to ogml.
	static const char * imageStyleToOGML(const GraphAttributes::ImageStyle &imgStyle);

	//! Static helper method for mapping brush patterns styles to ogml.
	static const char * brushPatternToOGML(const GraphAttributes::BrushPattern & brushPattern);

	//static void generateIndent(char ** indent, const int & indentSize);

	//! Static helper method for exchanging X(HT)ML-tag specific chars.
	String formatLabel(const String & labelText);

	/* End methods for OGML serialization */

	const Graph *m_pGraph; //!< associated graph

	bool m_directed; //!< whether or not the graph is directed

	// graphical representation of nodes
	NodeArray<double> m_x; //!< x-coordinate of a node
	NodeArray<double> m_y; //!< y-coordinate pf a node
	NodeArray<double> m_width; //!< width of a node's bounding box
	NodeArray<double> m_height; //!< height of a nodes's bounding box
	NodeArray<String> m_nodeLabel; //!< label of a node
	NodeArray<String> m_nodeColor; //!< color of a node
	NodeArray<String> m_nodeLine; //!< line color of a node
	NodeArray<int> m_nodeShape; //!< shape of a node
	NodeArray<double> m_nodeLineWidth; //!< line width of a node
	NodeArray<BrushPattern> m_nodePattern; //!< brush pattern of a node
	NodeArray<EdgeStyle> m_nodeStyle; //!< line style of a node
	NodeArray<String> m_nodeTemplate; //!< name of template of a node

	// images
	NodeArray<String> m_imageUri;
	NodeArray<ImageStyle> m_imageStyle;
	NodeArray<ImageAlignment> m_imageAlign;
	NodeArray<bool> m_imageDrawLine;
	NodeArray<double> m_imageWidth;
	NodeArray<double> m_imageHeight;

	// other node attributes
	NodeArray<int> m_nodeId; //!< user ID of a node
	NodeArray<int> m_level; //!< level of a node
	NodeArray<int> m_nodeIntWeight; //!< (integer) weight of a node
	NodeArray<Graph::NodeType> m_vType; // type (vertex, dummy, generalizationMerger)

	// graphical representation of edges
	EdgeArray<DPolyline> m_bends; //!< list of bend points of an edge
	EdgeArray<String> m_edgeLabel; //!< label of an edge
	EdgeArray<EdgeArrow> m_edgeArrow; //!< arrow type of an edge
	EdgeArray<EdgeStyle> m_edgeStyle; //!< line style of an edge
	EdgeArray<String> m_edgeColor; //!< line color of an edge
	EdgeArray<double> m_edgeWidth; //!< line width of an edge
	EdgeArray<Graph::EdgeType> m_eType; //!< type of an edge (association or generalization)

	// other edge attributes
	EdgeArray<int> m_intWeight; //!< (integer) weight of an edge
	EdgeArray<double> m_doubleWeight; //!< (real number) weight of an edge
	EdgeArray<unsigned int> m_subGraph; //!< is element of subgraphs given by bitvector

	long m_attributes; //!< bit vector of currently used attributes

public:
	//! Bits for specifying attributes.
	enum {
		nodeGraphics = 0x00001, //!< node attributes m_x, m_y, m_width, m_height, m_nodeShape
		edgeGraphics = 0x00002, //!< edge attribute m_bends
		nodeLevel = 0x00004, //!< node attribute m_level
		edgeIntWeight = 0x00008, //!< edge attribute m_intWeight
		edgeDoubleWeight = 0x00010, //!< edge attribute m_doubleWeight
		edgeLabel = 0x00020, //!< edge attribute m_edgeLabel
		nodeLabel = 0x00040, //!< node attribute m_nodeLabel
		edgeType = 0x00080, //!< edge attribute m_eType
		nodeType = 0x00100, //!< node attribute m_vType
		nodeColor = 0x00200, //!< node attribute m_nodeColor, m_nodeLine
		nodeId = 0x00400, //!< node attribute m_nodeId
		edgeArrow = 0x00800, //!< edge attribute m_edgeArrow
		edgeColor = 0x01000, //!< edge attribute m_edgeColor
		edgeStyle = 0x02000, //!< edge attribute m_edgeStyle, m_edgeWidth
		nodeStyle = 0x04000, //!< node attributes m_nodePattern, m_nodeStyle, m_nodeLineWidth;
		//!< experimental: m_imageUri, m_imageStyle, m_imageAlign,
		//!< m_imageDrawLine, m_imageWidth, m_imageHeight
		nodeTemplate = 0x08000, //!< node attribute m_nodeTemplate
		edgeSubGraph = 0x10000, //!< edge attribute m_subGraph
		nodeWeight = 0x20000
	//!< node attribute m_nodeIntWeight
	};

	//! Bits for specifying node shapes.
	enum {
		oval = 0x8001, rectangle = 0x8002
	};

	//! Constructs graph attributes for no associated graph (default constructor).
	/**
	 * The associated graph can be set later with the init() function.
	 */
	GraphAttributes();

	//! Constructs graph attributes associated with the graph \a G.
	/**
	 * @param G is the associated graph.
	 * @param initAttributes specifies the set of attributes that can be accessed.
	 */
	GraphAttributes(const Graph &G, long initAttributes = nodeGraphics | edgeGraphics);

	virtual ~GraphAttributes() {
	}

	//! Initializes the graph attributes for graph \a G.
	/**
	 * @param G is the new associated graph.
	 * @param initAttr specifies the set of attributes that can be accessed.
	 *
	 * \warning All attributes that were allocated before are destroyed by this function!
	 *  If you wish to extend the set of allocated attributes, use initAttributes().
	 */
	virtual void init(const Graph &G, long initAttr);

	//! Returns currently accessible attributes.
	long attributes() const {
		return m_attributes;
	}

	//! Initializes attributes in \a attr for usage.
	void initAttributes(long attr);

	//! Destroys attributes in attr.
	void destroyAttributes(long attr);

	//! Returns a reference to the associated graph
	const Graph& constGraph() const {
		return *m_pGraph;
	}

	//! Returns if the graph is directed.
	bool directed() {
		return m_directed;
	}

	//! Sets if the graph is directed to \a directed.
	void directed(bool directed) {
		m_directed = directed;
	}

	//! Returns the template name of node \a v.
	const String &templateNode(node v) const {
		return m_nodeTemplate[v];
	}
	//! Returns the template name of node \a v.
	String &templateNode(node v) {
		return m_nodeTemplate[v];
	}

	//! Returns the x-coordinate of node \a v.
	const double &x(node v) const {
		return m_x[v];
	}
	//! Returns the x-coordinate of node \a v.
	double &x(node v) {
		return m_x[v];
	}

	//! Returns the y-coordinate of node \a v.
	const double &y(node v) const {
		return m_y[v];
	}
	//! Returns the y-coordinate of node \a v.
	double &y(node v) {
		return m_y[v];
	}

	//! Returns a reference to the NodeArray \a m_width.
	const NodeArray<double> &width() const {
		return m_width;
	}
	//! Returns a refeence to the NodeArray \a m_width.
	NodeArray<double> &width() {
		return m_width;
	}

	//! Returns the width of the bounding box of node \a v.
	const double &width(node v) const {
		return m_width[v];
	}
	//! Returns the width of the bounding box of node \a v.
	double &width(node v) {
		return m_width[v];
	}

	//! Returns a reference to the NodeArray \a m_height.
	const NodeArray<double> &height() const {
		return m_height;
	}
	//! Returns a refeence to the NodeArray \a m_height.
	NodeArray<double> &height() {
		return m_height;
	}

	//! Returns the height of the bounding box of node \a v.
	const double &height(node v) const {
		return m_height[v];
	}
	//! Returns the height of the bounding box of node \a v.
	double &height(node v) {
		return m_height[v];
	}

	//! Returns the level of node \a v.
	const int &level(node v) const {
		return m_level[v];
	}
	//! Returns the level of node \a v.
	int &level(node v) {
		return m_level[v];
	}

	//! Returns the weight of node \a v.
	const int &weight(node v) const {
		return m_nodeIntWeight[v];
	}
	//! Returns the weight of node \a v.
	int &weight(node v) {
		return m_nodeIntWeight[v];
	}

	//! Returns the brush pattern of node \a v.
	const BrushPattern &nodePattern(node v) const {
		return m_nodePattern[v];
	}
	//! Returns the brush pattern of node \a v.
	BrushPattern &nodePattern(node v) {
		return m_nodePattern[v];
	}

	//! Returns the line style of node \ v.
	const EdgeStyle &styleNode(node v) const {
		return m_nodeStyle[v];
	}
	//! Returns the line style of node \ v.
	EdgeStyle &styleNode(node v) {
		return m_nodeStyle[v];
	}

	//! Returns the line width of node \a v.
	const double &lineWidthNode(node v) const {
		return m_nodeLineWidth[v];
	}
	//! Returns the line width of node \a v.
	double &lineWidthNode(node v) {
		return m_nodeLineWidth[v];
	}

	//! Returns the line color of node \a v.
	const String &nodeLine(node v) const {
		return m_nodeLine[v];
	}
	//! Returns the line color of node \a v.
	String &nodeLine(node v) {
		return m_nodeLine[v];
	}

	//! Returns the list of bend points of edge \a e.
	const DPolyline &bends(edge e) const {
		return m_bends[e];
	}
	//! Returns the list of bend points of edge \a e.
	DPolyline &bends(edge e) {
		return m_bends[e];
	}

	//! Returns the (integer) weight of edge \a e.
	const int &intWeight(edge e) const {
		return m_intWeight[e];
	}
	//! Returns the (integer) weight of edge \a e.
	int &intWeight(edge e) {
		return m_intWeight[e];
	}

	//! Returns the (real number) weight of edge \a e.
	const double &doubleWeight(edge e) const {
		return m_doubleWeight[e];
	}
	//! Returns the (real number) weight of edge \a e.
	double &doubleWeight(edge e) {
		return m_doubleWeight[e];
	}

	//! Returns the line width of edge \a e.
	const double &edgeWidth(edge e) const {
		return m_edgeWidth[e];
	}
	//! Returns the line width of edge \a e.
	double &edgeWidth(edge e) {
		return m_edgeWidth[e];
	}

	//! Returns the color of node \a v.
	const String &colorNode(node v) const {
		return m_nodeColor[v];
	}
	//! Returns the color of node \a v.
	String &colorNode(node v) {
		return m_nodeColor[v];
	}

	//! Returns the shape type of node \a v.
	int shapeNode(node v) const {
		return m_nodeShape[v];
	}
	//! Returns the shape type of node \a v.
	int &shapeNode(node v) {
		return m_nodeShape[v];
	}

	//! Returns the label of node \ v.
	const String &labelNode(node v) const {
		return m_nodeLabel[v];
	}
	//! Returns the label of node \ v.
	String &labelNode(node v) {
		return m_nodeLabel[v];
	}

	//! Returns the label of edge \a e.
	const String &labelEdge(edge e) const {
		return m_edgeLabel[e];
	}
	//! Returns the label of edge \a e.
	String &labelEdge(edge e) {
		return m_edgeLabel[e];
	}

	//! Returns the type of edge \a e.
	Graph::EdgeType type(edge e) const {
		return m_eType.valid() ? m_eType[e] : Graph::association;
	}
	//! Returns the type of edge \a e.
	Graph::EdgeType &type(edge e) {
		return m_eType[e];
	}

	//! Returns the type of node \a v.
	Graph::NodeType type(node v) const {
		return m_vType.valid() ? m_vType[v] : Graph::vertex;
	}
	//! Returns the type of node \a v.
	Graph::NodeType &type(node v) {
		return m_vType[v];
	}

	//! Returns the user ID of node \a v.
	const int &idNode(node v) const {
		return m_nodeId[v];
	}
	//! Returns the user ID of node \a v.
	int &idNode(node v) {
		return m_nodeId[v];
	}

	//! Returns the arrow type of edge \a e.
	const EdgeArrow &arrowEdge(edge e) const {
		return m_edgeArrow[e];
	}
	//! Returns the arrow type of edge \a e.
	EdgeArrow &arrowEdge(edge e) {
		return m_edgeArrow[e];
	}

	//! Returns the line style of an edge \a e.
	const EdgeStyle &styleEdge(edge e) const {
		return m_edgeStyle[e];
	}
	//! Returns the line style of an edge \a e.
	EdgeStyle &styleEdge(edge e) {
		return m_edgeStyle[e];
	}

	//! Returns the color of node \a v.
	const String &colorEdge(edge e) const {
		return m_edgeColor[e];
	}
	//! Returns the color of node \a v.
	String &colorEdge(edge e) {
		return m_edgeColor[e];
	}

	// Images:
	//! Returns image uri of node v.
	const String &imageUriNode(node v) const {
		return m_imageUri[v];
	}
	//! Returns image uri of node v.
	String &imageUriNode(node v) {
		return m_imageUri[v];
	}
	//! Returns image style of node v.
	const ImageStyle &imageStyleNode(node v) const {
		return m_imageStyle[v];
	}
	//! Returns image style of node v.
	ImageStyle &imageStyleNode(node v) {
		return m_imageStyle[v];
	}
	// Returns image alignment of node v.
	const ImageAlignment &imageAlignmentNode(node v) const {
		return m_imageAlign[v];
	}
	// Returns image alignment of node v.
	ImageAlignment &imageAlignmentNode(node v) {
		return m_imageAlign[v];
	}
	//! Returns bool value drawLine of node v.
	const bool &imageDrawLineNode(node v) const {
		return m_imageDrawLine[v];
	}
	//! Returns bool value drawLine of node v.
	bool &imageDrawLineNode(node v) {
		return m_imageDrawLine[v];
	}
	//! Returns image width of node v.
	const double &imageWidthNode(node v) const {
		return m_imageWidth[v];
	}
	//! Returns image width of node v.
	double &imageWidthNode(node v) {
		return m_imageWidth[v];
	}
	// Returns image height of node v.
	const double &imageHeightNode(node v) const {
		return m_imageHeight[v];
	}
	// Returns image height of node v.
	double &imageHeightNode(node v) {
		return m_imageHeight[v];
	}

	//! Returns the edgesubgraph value of an edge \a e.
	const unsigned int &subGraphBits(edge e) const {
		return m_subGraph[e];
	}
	//! Returns the edgesubgraph value of an edge \a e.
	unsigned int &subGraphBits(edge e) {
		return m_subGraph[e];
	}

	//! Checks whether edge \a e belongs to basic graph \a n.
	bool inSubGraph(edge e, int n) const {
		OGDF_ASSERT( n>=0 && n<32 );
		return (m_subGraph[e] & (1 << n)) != 0;
	}
	//! Addes edge \a e to basic graph \a n.
	void addSubGraph(edge e, int n) {
		OGDF_ASSERT( n>=0 && n<32 );
		m_subGraph[e] |= (1 << n);
	}
	//! Removes edge \a e from basic graph \a n.
	void removeSubGraph(edge e, int n) {
		OGDF_ASSERT( n>=0 && n<32 );
		m_subGraph[e] &= ~(1 << n);
	}

	//! Returns the bounding box of the graph.
	const DRect boundingBox() const;

	/**
	 * We hide the internal representation of semantic node types from
	 * the user to be able to change this later (semantic node type member array).
	 * We are not allowed to set association classes manually, only by calling
	 * createAssociationClass().
	 */
	bool isAssociationClass(node v) const {
		return (type(v) == Graph::associationClass);
	}

	/**
	 * According to the \a mode switch add either the node center points to
	 * the bends or the anchor point on the node boundary
	 *   - \a mode = 0: only add node center
	 *   - \a mode = 1: compute intersection with the line segment to the center
	 *     and the boundary of the rectangular node
	 *   - \a mode = 2: compute intersection with the first/last line segment
	 *     and the boundary of the rectangular node
	 */
	void addNodeCenter2Bends(int mode = 1);

	void clearAllBends();

	//! Returns a list of all inheritance hierarchies in the graph.
	/**
	 * Inheritance hierarchies are identified by edges with type Graph::generalization.
	 *
	 * @param list is a list of all hierarchies; each hierarchie is itself a list
	 *        of all nodes in this hierarchy.
	 *
	 * \return Returns the number of generalization hierarchies.
	 */
	int hierarchyList(List<List<node>*> &list) const;

	//! Returns a list of all inheritance hierarchies in the graph.
	/**
	 * Inheritance hierarchies are identified by edges with type Graph::generalization.
	 *
	 * @param list is a list of all hierarchies; each hierarchie is itself a list
	 *        of all edges in this hierarchy.
	 *
	 * \return Returns the number of generalization hierarchies.
	 */
	int hierarchyList(List<List<edge>*> &list) const;

	//! Sets the width of all nodes to \a w.
	void setAllWidth(double w);
	//! Sets the height of all nodes to \a h.
	void setAllHeight(double h);

	//! Reads the graph from a GML file \a fileName.
	bool readGML(Graph &G, const String &fileName);

	//! Reads the graph from a GML input stream \a is.
	bool readGML(Graph &G, istream &is);

	//! Writes the graph with its attributes in GML format to file \a fileName.
	void writeGML(const String &fileName) const;

	//! Writes the graph with its attributes in GML format to output stream \a os.
	void writeGML(ostream &os) const;

	//! Writes the graph with its attributes in SVG format to file \a fileName.
	/**
	 * @param fileName filename of the SVG
	 * @param fontSize size of node label (default = 3)
	 * @param fontColor color of node label (default = #000000)
	 */
	void writeSVG(const String &fileName, int fontSize = 3, const String &fontColor = "#000000") const;

	//! Writes the graph with its attributes in SVG format to output stream \a os.
	/**
	 * @param os output stream for SVG
	 * @param fontSize size of node label
	 * @param fontColor color of node label
	 */
	void writeSVG(ostream &os, int fontSize, const String &fontColor) const;

	//! Reads the graph and attributes from the XML file \a fileName.
	bool readXML(Graph &G, const String &fileName);

	//! Reads the graph and attributes from the XML input stream \a is.
	bool readXML(Graph &G, istream &is);

	//! Writes the graph to the XML file \a fileName.
	void writeXML(const String &fileName, const char* delimiter = "", const char* offset = "") const;

	//! Writes the graph to XML output stream \a os.
	virtual void writeXML(ostream &os, const char* delimiter = "", const char* offset = "") const;

	//! Reads a graph in Rudy format from file \a fileName.
	bool readRudy(Graph &G, const String &fileName);

	//! Reads a graph in Rudy format from input stream \a is.
	bool readRudy(Graph &G, istream &is);

	//! Writes the graph in Rudy format to file \a fileName.
	void writeRudy(const String &fileName) const;

	//! Writes the graph in Rudy format to output stream \a os.
	void writeRudy(ostream &os) const;

	//! Removes unnecessary bend points in orthogonal segements.
	/**
	 * Processes all edges and removes unnecessary bend points in the bend point list
	 * of the edge, i.e., bend points such that the preceding and succeeding bend point
	 * form a horizontal or vertical segement containing this bend point. This function
	 * is useful to remove redundant bend points in an orthogonal layout.
	 */
	void removeUnnecessaryBendsHV();
};

} // end namespace ogdf


#endif