Draw a simple graph structure.
The graph layout is made using graphviz. This macro creates some nodes and edges and change a few graphical attributes on some of them.
{
#if __has_include("TGraphStruct.h")
TGraphNode *n6 = gs->AddNode(
"n6",
"Node number six");
gs->AddEdge(n0,n1)->SetLineColor(
kRed);
gs->AddEdge(n1,n7);
gs->AddEdge(n4,n6);
gs->AddEdge(n3,n9);
gs->AddEdge(n6,n8);
gs->AddEdge(n7,n2);
gs->AddEdge(n8,n3);
gs->AddEdge(n2,n3);
gs->AddEdge(n9,n0);
gs->AddEdge(n1,n4);
gs->AddEdge(n1,n6);
gs->AddEdge(n2,n5);
gs->AddEdge(n3,n6);
gs->AddEdge(n4,n5);
gs->Draw();
#else
return new TCanvas(
"c",
"c",800,600);
#endif
}
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
virtual void SetTextFont(Font_t tfont=62)
Set the text font.
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
An edge object connecting two nodes which can be added in a TGraphStruct.
A graph node object which can be added in a TGraphStruct.
- Note
- For this to work, ROOT has to be compiled with gviz ON
- Author
- Olivier Couet
Definition in file gr016_struct.C.