Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
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
22
__GTL_BEGIN_NAMESPACE
23
24
//--------------------------------------------------------------------------
25
// algorithm - interface
26
//--------------------------------------------------------------------------
27
28
29
void
topsort::reset
()
30
{
31
dfs::reset
();
32
acyclic
=
true
;
33
top_order
.erase (
top_order
.begin(),
top_order
.end());;
34
}
35
36
int
topsort::check
(
graph
& G)
37
{
38
return
G.
is_directed
() ?
GTL_OK
:
GTL_ERROR
;
39
}
40
41
42
43
//--------------------------------------------------------------------------
44
// Handler
45
//--------------------------------------------------------------------------
46
47
48
void
topsort::init_handler
(
graph
& G)
49
{
50
top_numbers
.
init
(G, 0);
51
act_top_num
= G.
number_of_nodes
();
52
}
53
54
55
void
topsort::leave_handler
(
graph
& G,
node
&
n
,
node
&
f
)
56
{
57
top_numbers
[
n
] =
act_top_num
;
58
act_top_num
--;
59
top_order
.push_front (n);
60
}
61
62
63
void
topsort::old_adj_node_handler
(
graph
& G,
edge
& adj,
node
& opp)
64
{
65
if
(
top_numbers
[opp] == 0) {
66
acyclic
=
false
;
67
}
68
}
69
70
__GTL_END_NAMESPACE
71
72
//--------------------------------------------------------------------------
73
// end of file
74
//--------------------------------------------------------------------------
JETSCAPE
blob
main
external_packages
gtl
src
topsort.cpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:23
using
1.8.2 with
sPHENIX GitHub integration