Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
topsort.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file topsort.h
1 /* This software is distributed under the GNU Lesser General Public License */
2 //==========================================================================
3 //
4 // topsort.h
5 //
6 //==========================================================================
7 // $Id: topsort.h,v 1.8 2000/09/11 07:36:43 raitner Exp $
8 
9 #ifndef GTL_TOPSORT
10 #define GTL_TOPSORT
11 
12 #include <GTL/GTL.h>
13 #include <GTL/dfs.h>
14 
16 
35 class GTL_EXTERN topsort : public dfs
36 {
37 public:
43  topsort () : dfs () {whole_graph = true; acyclic = true;}
44 
51  int top_num (const node& n) const
52  { return top_numbers[n]; }
53 
59  bool is_acyclic () const
60  { return acyclic; }
61 
65  typedef list<node>::const_iterator topsort_iterator;
66 
72  topsort_iterator top_order_begin() const
73  { return top_order.begin(); }
74 
80  topsort_iterator top_order_end() const
81  { return top_order.end(); }
82 
95  virtual int check (graph& G);
96 
101  virtual void reset ();
102 
106  virtual void init_handler (graph& G);
107 
111  virtual void leave_handler (graph&, node&, node&);
112 
116  virtual void old_adj_node_handler (graph&, edge&, node&);
117 
118 protected:
130  list<node> top_order;
134  bool acyclic;
135 };
136 
138 
139 #endif // GTL_TOPSORT
140 
141 //--------------------------------------------------------------------------
142 // end of file
143 //--------------------------------------------------------------------------