Loading [MathJax]/extensions/tex2jax.js
ROOT
6.14/05
Reference Guide
ROOT Home
Main Page
Tutorials
Functional Parts
+
Namespaces
Namespace List
+
Namespace Members
+
All
<
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
<
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Typedefs
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
u
w
x
+
Enumerations
a
e
f
g
m
p
t
v
w
y
+
Enumerator
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
w
+
All Classes
Class List
Class Index
Class Hierarchy
+
Class Members
+
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
+
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
y
+
Enumerations
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
w
y
+
Enumerator
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
+
Properties
f
+
Related Functions
:
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
+
Files
File List
+
File Members
+
All
1
2
3
4
5
6
7
8
9
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
+
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Typedefs
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
+
Enumerations
c
e
f
i
l
m
p
r
u
x
+
Enumerator
a
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
u
v
w
+
Macros
1
2
3
4
5
6
7
8
9
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Release Notes
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
tutorials
graphs
graphstruct.C
Go to the documentation of this file.
1
/// \file
2
/// \ingroup tutorial_graphs
3
/// \notebook
4
/// Draw a simple graph structure.
5
/// The graph layout is made using graphviz. This macro creates some
6
/// nodes and edges and change a few graphical attributes on some of them.
7
///
8
/// \macro_image
9
/// \macro_code
10
///
11
/// \author Olivier Couet
12
13
TCanvas
* graphstruct()
14
{
15
TGraphStruct
*gs =
new
TGraphStruct
();
16
17
// create some nodes and put them in the graph in one go ...
18
TGraphNode
*n0 = gs->
AddNode
(
"n0"
,
"Node 0"
);
19
TGraphNode
*n1 = gs->
AddNode
(
"n1"
,
"First node"
);
20
TGraphNode
*n2 = gs->
AddNode
(
"n2"
,
"Second node"
);
21
TGraphNode
*n3 = gs->
AddNode
(
"n3"
,
"Third node"
);
22
TGraphNode
*n4 = gs->
AddNode
(
"n4"
,
"Fourth node"
);
23
TGraphNode
*n5 = gs->
AddNode
(
"n5"
,
"5th node"
);
24
TGraphNode
*n6 = gs->
AddNode
(
"n6"
,
"Node number six"
);
25
TGraphNode
*n7 = gs->
AddNode
(
"n7"
,
"Node 7"
);
26
TGraphNode
*n8 = gs->
AddNode
(
"n8"
,
"Node 8"
);
27
TGraphNode
*n9 = gs->
AddNode
(
"n9"
,
"Node 9"
);
28
29
n4->
SetTextSize
(0.03);
30
n6->
SetTextSize
(0.03);
31
n2->
SetTextSize
(0.04);
32
33
n3->
SetTextFont
(132);
34
35
n0->
SetTextColor
(
kRed
);
36
37
n9->
SetFillColor
(
kRed
-10);
38
n0->
SetFillColor
(
kYellow
-9);
39
n7->
SetFillColor
(
kViolet
-9);
40
41
// some edges ...
42
gs->
AddEdge
(n0,n1)->SetLineColor(
kRed
);
43
TGraphEdge
*e06 = gs->
AddEdge
(n0,n6);
44
e06->
SetLineColor
(
kRed
-3);
45
e06->
SetLineWidth
(4);
46
gs->
AddEdge
(n1,n7);
47
gs->
AddEdge
(n4,n6);
48
gs->
AddEdge
(n3,n9);
49
gs->
AddEdge
(n6,n8);
50
gs->
AddEdge
(n7,n2);
51
gs->
AddEdge
(n8,n3);
52
gs->
AddEdge
(n2,n3);
53
gs->
AddEdge
(n9,n0);
54
gs->
AddEdge
(n1,n4);
55
gs->
AddEdge
(n1,n6);
56
gs->
AddEdge
(n2,n5);
57
gs->
AddEdge
(n3,n6);
58
gs->
AddEdge
(n4,n5);
59
60
TCanvas
*
c
=
new
TCanvas
(
"c"
,
"c"
,800,600);
61
c->
SetFillColor
(38);
62
gs->
Draw
();
63
return
c
;
64
}
TAttLine::SetLineWidth
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition:
TAttLine.h:43
kRed
Definition:
Rtypes.h:59
kYellow
Definition:
Rtypes.h:59
TGraphStruct
The Graph Structure is an interface to the graphviz package.
Definition:
TGraphStruct.h:24
TAttText::SetTextFont
virtual void SetTextFont(Font_t tfont=62)
Set the text font.
Definition:
TAttText.h:45
TGraphEdge
An edge object connecting two nodes which can be added in a TGraphStruct.
Definition:
TGraphEdge.h:25
TGraphStruct::AddNode
void AddNode(TGraphNode *node)
Add the node "node" in this TGraphStruct.
Definition:
TGraphStruct.cxx:114
TAttLine::SetLineColor
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition:
TAttLine.h:40
TAttFill::SetFillColor
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition:
TAttFill.h:37
TGraphStruct::AddEdge
void AddEdge(TGraphEdge *edge)
Add the edge "edge" in this TGraphStruct.
Definition:
TGraphStruct.cxx:88
TGraphStruct::Draw
void Draw(Option_t *option="")
Draw the graph.
Definition:
TGraphStruct.cxx:158
TCanvas
The Canvas class.
Definition:
TCanvas.h:31
TGraphNode
A graph node object which can be added in a TGraphStruct.
Definition:
TGraphNode.h:27
kViolet
Definition:
Rtypes.h:60
TAttText::SetTextColor
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
Definition:
TAttText.h:43
c
#define c(i)
Definition:
RSha256.hxx:101
TAttText::SetTextSize
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
Definition:
TAttText.h:46