3
/// This file is part of Rheolef.
5
/// Copyright (C) 2000-2009 Pierre Saramito <Pierre.Saramito@imag.fr>
7
/// Rheolef is free software; you can redistribute it and/or modify
8
/// it under the terms of the GNU General Public License as published by
9
/// the Free Software Foundation; either version 2 of the License, or
10
/// (at your option) any later version.
12
/// Rheolef is distributed in the hope that it will be useful,
13
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
/// GNU General Public License for more details.
17
/// You should have received a copy of the GNU General Public License
18
/// along with Rheolef; if not, write to the Free Software
19
/// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
/// =========================================================================
23
/* degree.f -- translated by f2c (version 19931217).*/
25
/*****************************************************************/
26
/********* DEGREE ..... DEGREE IN MASKED COMPONENT *********/
27
/*****************************************************************/
29
/* PURPOSE - THIS ROUTINE COMPUTES THE DEGREES OF THE NODES*/
30
/* IN THE CONNECTED COMPONENT SPECIFIED BY MASK AND ROOT*/
31
/* NODES FOR WHICH MASK IS ZERO ARE IGNORED.*/
33
/* INPUT PARAMETER -*/
34
/* ROOT - IS THE INPUT NODE THAT DEFINES THE COMPONENT.*/
35
/* (XADJ, ADJNCY) - ADJACENCY STRUCTURE PAIR.*/
36
/* MASK - SPECIFIES A SECTION SUBGRAPH.*/
38
/* OUTPUT PARAMETERS -*/
39
/* DEG - ARRAY CONTAINING THE DEGREES OF THE NODES IN*/
41
/* CCSIZE-SIZE OF THE COMPONENT SPECIFED BY MASK AND ROOT*/
42
/* WORKING PARAMETER -*/
43
/* LS - A TEMPORARY VECTOR USED TO STORE THE NODES OF THE*/
44
/* COMPONENT LEVEL BY LEVEL.*/
45
/*****************************************************************/
47
template <class Iterator>
58
typedef typename std::iterator_traits<Iterator>::value_type Integer;
60
/* System generated locals */
64
static Integer ideg, node, i, j, jstop, jstrt, lbegin, lvlend, lvsize,
66
/* INITIALIZATION ...*/
67
/* THE ARRAY XADJ IS USED AS A TEMPORARY MARKER TO*/
68
/* INDICATE WHICH NODES HAVE BEEN CONSIDERED SO FAR.*/
70
/* Parameter adjustments */
78
xadj[*root] = -xadj[*root];
81
/* LBEGIN IS THE POINTER TO THE BEGINNING OF THE CURRENT*/
82
/* LEVEL, AND LVLEND POINTS TO THE END OF THIS LEVEL.*/
86
/* FIND THE DEGREES OF NODES IN THE CURRENT LEVEL,*/
87
/* AND AT THE SAME TIME, GENERATE THE NEXT LEVEL.*/
89
for (i = lbegin; i <= i__1; ++i) {
92
jstop = (i__2 = xadj[node + 1], (Integer)abs(i__2)) - 1;
98
for (j = jstrt; j <= i__2; ++j) {
100
if (mask[nbr] == 0) {
107
xadj[nbr] = -xadj[nbr];
116
/* COMPUTE THE CURRENT LEVEL WIDTH. */
117
/* IF IT IS NONZERO , GENERATE ANOTHER LEVEL.*/
118
lvsize = *ccsize - lvlend;
122
/* RESET XADJ TO ITS CORRECT SIGN AND RETURN. */
123
/* ------------------------------------------*/
125
for (i = 1; i <= i__1; ++i) {
127
xadj[node] = -xadj[node];