Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 #include "TObject.h"
16 #include "TGraphEdge.h"
17 #include "TGraphNode.h"
18 #include "TList.h"
19 
20 struct GVizAgraph_t;
21 struct GVC_s;
22 
23 
24 class TGraphStruct : public TObject {
25 
26 protected:
27 
28  GVizAgraph_t *fGVGraph; ///< Graphviz graph
29  GVC_s *fGVC; ///< Graphviz context
30  TList *fNodes; ///< List of nodes in this TGraphStruct
31  TList *fEdges; ///< List of edges in this TGraphStruct
32  Double_t fMargin; ///< Margin around the graph (in dots)
33 
34 public:
35 
36  TGraphStruct();
37  virtual ~TGraphStruct();
38 
39  void AddEdge(TGraphEdge *edge);
40  void AddNode(TGraphNode *node);
41  TGraphEdge *AddEdge(TGraphNode *n1, TGraphNode *n2);
42  TGraphNode *AddNode(const char *name, const char *title="");
43  void Draw(Option_t *option="");
44  void DumpAsDotFile(const char *filename);
45  TList *GetListOfNodes() const { return fNodes; }
46  TList *GetListOfEdges() const { return fEdges; }
47  Int_t Layout();
48  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
49  void SetMargin(Double_t m=10) {fMargin = m;}
50 
51  ClassDef(TGraphStruct,2) //Graph structure class
52 };
53 
54 #endif