ROOT  6.06/09
Reference Guide
TGraphStruct.h
Go to the documentation of this file.
1 // @(#)root/hist:$Id$
2 // Author: Olivier Couet 13/07/09
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TGraphStruct
13 #define ROOT_TGraphStruct
14 
15 #ifndef ROOT_TObject
16 #include "TObject.h"
17 #endif
18 #ifndef ROOT_TGraphEdge
19 #include "TGraphEdge.h"
20 #endif
21 #ifndef ROOT_TGraphNode
22 #include "TGraphNode.h"
23 #endif
24 #ifndef ROOT_TList
25 #include "TList.h"
26 #endif
27 
28 struct GVizAgraph_t;
29 struct GVC_s;
30 
31 //////////////////////////////////////////////////////////////////////////
32 // //
33 // TGraphStruct //
34 // //
35 // Interface to the graphviz package. //
36 // //
37 //////////////////////////////////////////////////////////////////////////
38 
39 
40 class TGraphStruct : public TObject {
41 
42 protected:
43 
44 
45  GVizAgraph_t *fGVGraph; //Graphviz graph
46  GVC_s *fGVC; //Graphviz context
47  TList *fNodes; //List of nodes in this TGraphStruct
48  TList *fEdges; //List of edges in this TGraphStruct
49  Double_t fMargin; //Margin around the graph (in dots)
50 
51 public:
52 
53  TGraphStruct();
54  virtual ~TGraphStruct();
55 
56  void AddEdge(TGraphEdge *edge);
57  void AddNode(TGraphNode *node);
59  TGraphNode *AddNode(const char *name, const char *title="");
60  void Draw(Option_t *option="");
61  void DumpAsDotFile(const char *filename);
62  TList *GetListOfNodes() const { return fNodes; }
63  TList *GetListOfEdges() const { return fEdges; }
64  Int_t Layout();
65  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
66  void SetMargin(Double_t m=10) {fMargin = m;}
67 
68  ClassDef(TGraphStruct,2) //Graph structure class
69 };
70 
71 #endif
void DumpAsDotFile(const char *filename)
Dump this graph structure as a "dot" file.
const char Option_t
Definition: RtypesCore.h:62
TList * GetListOfNodes() const
Definition: TGraphStruct.h:62
static const char * filename()
int Int_t
Definition: RtypesCore.h:41
TList * GetListOfEdges() const
Definition: TGraphStruct.h:63
Double_t fMargin
Definition: TGraphStruct.h:49
The Graph Structure is an interface to the graphviz package.
Definition: TGraphStruct.h:40
TList * fNodes
Definition: TGraphStruct.h:47
An edge object connecting two nodes which can be added in a TGraphStruct.
Definition: TGraphEdge.h:37
void AddNode(TGraphNode *node)
Add the node "node" in this TGraphStruct.
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual ~TGraphStruct()
Graph Structure default destructor.
char * out
Definition: TBase64.cxx:29
A doubly linked list.
Definition: TList.h:47
Int_t Layout()
Layout the graph into a GraphViz data structure.
void SetMargin(Double_t m=10)
Definition: TGraphStruct.h:66
TList * fEdges
Definition: TGraphStruct.h:48
void AddEdge(TGraphEdge *edge)
Add the edge "edge" in this TGraphStruct.
void Draw(Option_t *option="")
Draw the graph.
TMarker * m
Definition: textangle.C:8
double Double_t
Definition: RtypesCore.h:55
A graph node object which can be added in a TGraphStruct.
Definition: TGraphNode.h:43
#define name(a, b)
Definition: linkTestLib0.cpp:5
GVizAgraph_t * fGVGraph
Definition: TGraphStruct.h:45
Mother of all ROOT objects.
Definition: TObject.h:58
GVC_s * fGVC
Definition: TGraphStruct.h:46
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.