Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
topsort.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file topsort.cpp
1 /* This software is distributed under the GNU Lesser General Public License */
2 //==========================================================================
3 //
4 // topsort.cpp
5 //
6 //==========================================================================
7 // $Id: topsort.cpp,v 1.7 2001/11/07 13:58:12 pick Exp $
8 
9 #include <GTL/topsort.h>
10 
11 #ifdef __GTL_MSVCC
12 # ifdef _DEBUG
13 # ifndef SEARCH_MEMORY_LEAKS_ENABLED
14 # error SEARCH NOT ENABLED
15 # endif
16 # define new DEBUG_NEW
17 # undef THIS_FILE
18  static char THIS_FILE[] = __FILE__;
19 # endif // _DEBUG
20 #endif // __GTL_MSVCC
21 
23 
24 //--------------------------------------------------------------------------
25 // algorithm - interface
26 //--------------------------------------------------------------------------
27 
28 
30 {
31  dfs::reset();
32  acyclic = true;
33  top_order.erase (top_order.begin(), top_order.end());;
34 }
35 
37 {
38  return G.is_directed() ? GTL_OK : GTL_ERROR;
39 }
40 
41 
42 
43 //--------------------------------------------------------------------------
44 // Handler
45 //--------------------------------------------------------------------------
46 
47 
49 {
50  top_numbers.init (G, 0);
52 }
53 
54 
56 {
58  act_top_num--;
59  top_order.push_front (n);
60 }
61 
62 
64 {
65  if (top_numbers[opp] == 0) {
66  acyclic = false;
67  }
68 }
69 
71 
72 //--------------------------------------------------------------------------
73 // end of file
74 //--------------------------------------------------------------------------