ROOT logo
// @(#)root/hist:$Id: TGraphStruct.h 31001 2009-11-06 08:39:48Z couet $
// Author: Olivier Couet 13/07/09

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TGraphStruct
#define ROOT_TGraphStruct

#ifndef ROOT_TObject
#include "TObject.h"
#endif
#ifndef ROOT_TGraphEdge
#include "TGraphEdge.h"
#endif
#ifndef ROOT_TGraphNode
#include "TGraphNode.h"
#endif
#ifndef ROOT_TList
#include "TList.h"
#endif

struct Agraph_t;
struct GVC_s;

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TGraphStruct                                                         //
//                                                                      //
// Interface to the graphviz package.                                   //
//                                                                      //
//////////////////////////////////////////////////////////////////////////


class TGraphStruct : public TObject {

protected:

   Agraph_t *fGVGraph; //Graphviz graph
   GVC_s    *fGVC;     //Graphviz context
   TList    *fNodes;   //List of nodes in this TGraphStruct
   TList    *fEdges;   //List of edges in this TGraphStruct
   Double_t  fMargin;  //Margin around the graph (in dots)

public:

   TGraphStruct();
   virtual ~TGraphStruct();

   void         AddEdge(TGraphEdge *edge);
   void         AddNode(TGraphNode *node);
   TGraphEdge  *AddEdge(TGraphNode *n1, TGraphNode *n2);
   TGraphNode  *AddNode(const char *name, const char *title="");
   void         Draw(Option_t *option="");
   void         DumpAsDotFile(const char *filename);
   TList       *GetListOfNodes() const { return fNodes; }
   TList       *GetListOfEdges() const { return fEdges; }
   Int_t        Layout();
   virtual void SavePrimitive(ostream &out, Option_t *option = "");
   void         SetMargin(Double_t m=10) {fMargin = m;}

   ClassDef(TGraphStruct,1)  //Graph structure class
};

#endif
 TGraphStruct.h:1
 TGraphStruct.h:2
 TGraphStruct.h:3
 TGraphStruct.h:4
 TGraphStruct.h:5
 TGraphStruct.h:6
 TGraphStruct.h:7
 TGraphStruct.h:8
 TGraphStruct.h:9
 TGraphStruct.h:10
 TGraphStruct.h:11
 TGraphStruct.h:12
 TGraphStruct.h:13
 TGraphStruct.h:14
 TGraphStruct.h:15
 TGraphStruct.h:16
 TGraphStruct.h:17
 TGraphStruct.h:18
 TGraphStruct.h:19
 TGraphStruct.h:20
 TGraphStruct.h:21
 TGraphStruct.h:22
 TGraphStruct.h:23
 TGraphStruct.h:24
 TGraphStruct.h:25
 TGraphStruct.h:26
 TGraphStruct.h:27
 TGraphStruct.h:28
 TGraphStruct.h:29
 TGraphStruct.h:30
 TGraphStruct.h:31
 TGraphStruct.h:32
 TGraphStruct.h:33
 TGraphStruct.h:34
 TGraphStruct.h:35
 TGraphStruct.h:36
 TGraphStruct.h:37
 TGraphStruct.h:38
 TGraphStruct.h:39
 TGraphStruct.h:40
 TGraphStruct.h:41
 TGraphStruct.h:42
 TGraphStruct.h:43
 TGraphStruct.h:44
 TGraphStruct.h:45
 TGraphStruct.h:46
 TGraphStruct.h:47
 TGraphStruct.h:48
 TGraphStruct.h:49
 TGraphStruct.h:50
 TGraphStruct.h:51
 TGraphStruct.h:52
 TGraphStruct.h:53
 TGraphStruct.h:54
 TGraphStruct.h:55
 TGraphStruct.h:56
 TGraphStruct.h:57
 TGraphStruct.h:58
 TGraphStruct.h:59
 TGraphStruct.h:60
 TGraphStruct.h:61
 TGraphStruct.h:62
 TGraphStruct.h:63
 TGraphStruct.h:64
 TGraphStruct.h:65
 TGraphStruct.h:66
 TGraphStruct.h:67
 TGraphStruct.h:68
 TGraphStruct.h:69
 TGraphStruct.h:70