00001 // @(#)root/hist:$Id: TGraphStruct.h 31001 2009-11-06 08:39:48Z couet $ 00002 // Author: Olivier Couet 13/07/09 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * 00006 * All rights reserved. * 00007 * * 00008 * For the licensing terms see $ROOTSYS/LICENSE. * 00009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00010 *************************************************************************/ 00011 00012 #ifndef ROOT_TGraphStruct 00013 #define ROOT_TGraphStruct 00014 00015 #ifndef ROOT_TObject 00016 #include "TObject.h" 00017 #endif 00018 #ifndef ROOT_TGraphEdge 00019 #include "TGraphEdge.h" 00020 #endif 00021 #ifndef ROOT_TGraphNode 00022 #include "TGraphNode.h" 00023 #endif 00024 #ifndef ROOT_TList 00025 #include "TList.h" 00026 #endif 00027 00028 struct Agraph_t; 00029 struct GVC_s; 00030 00031 ////////////////////////////////////////////////////////////////////////// 00032 // // 00033 // TGraphStruct // 00034 // // 00035 // Interface to the graphviz package. // 00036 // // 00037 ////////////////////////////////////////////////////////////////////////// 00038 00039 00040 class TGraphStruct : public TObject { 00041 00042 protected: 00043 00044 Agraph_t *fGVGraph; //Graphviz graph 00045 GVC_s *fGVC; //Graphviz context 00046 TList *fNodes; //List of nodes in this TGraphStruct 00047 TList *fEdges; //List of edges in this TGraphStruct 00048 Double_t fMargin; //Margin around the graph (in dots) 00049 00050 public: 00051 00052 TGraphStruct(); 00053 virtual ~TGraphStruct(); 00054 00055 void AddEdge(TGraphEdge *edge); 00056 void AddNode(TGraphNode *node); 00057 TGraphEdge *AddEdge(TGraphNode *n1, TGraphNode *n2); 00058 TGraphNode *AddNode(const char *name, const char *title=""); 00059 void Draw(Option_t *option=""); 00060 void DumpAsDotFile(const char *filename); 00061 TList *GetListOfNodes() const { return fNodes; } 00062 TList *GetListOfEdges() const { return fEdges; } 00063 Int_t Layout(); 00064 virtual void SavePrimitive(ostream &out, Option_t *option = ""); 00065 void SetMargin(Double_t m=10) {fMargin = m;} 00066 00067 ClassDef(TGraphStruct,1) //Graph structure class 00068 }; 00069 00070 #endif