1 /* Copyright 2004,2007,2010 ENSEIRB, INRIA & CNRS
2 **
3 ** This file is part of the Scotch software package for static mapping,
4 ** graph partitioning and sparse matrix ordering.
5 **
6 ** This software is governed by the CeCILL-C license under French law
7 ** and abiding by the rules of distribution of free software. You can
8 ** use, modify and/or redistribute the software under the terms of the
9 ** CeCILL-C license as circulated by CEA, CNRS and INRIA at the following
10 ** URL: "http://www.cecill.info".
11 **
12 ** As a counterpart to the access to the source code and rights to copy,
13 ** modify and redistribute granted by the license, users are provided
14 ** only with a limited warranty and the software's author, the holder of
15 ** the economic rights, and the successive licensors have only limited
16 ** liability.
17 **
18 ** In this respect, the user's attention is drawn to the risks associated
19 ** with loading, using, modifying and/or developing or reproducing the
20 ** software by the user in light of its specific status of free software,
21 ** that may mean that it is complicated to manipulate, and that also
22 ** therefore means that it is reserved for developers and experienced
23 ** professionals having in-depth computer knowledge. Users are therefore
24 ** encouraged to load and test the software's suitability as regards
25 ** their requirements in conditions enabling the security of their
26 ** systems and/or data to be ensured and, more generally, to use and
27 ** operate it in the same conditions as regards security.
28 **
29 ** The fact that you are presently reading this means that you have had
30 ** knowledge of the CeCILL-C license and that you accept its terms.
31 */
32 /************************************************************/
33 /**                                                        **/
34 /**   NAME       : bgraph_bipart_gp.h                      **/
35 /**                                                        **/
36 /**   AUTHOR     : Francois PELLEGRINI                     **/
37 /**                                                        **/
38 /**   FUNCTION   : These lines are the data declaration    **/
39 /**                for the Gibbs, Poole, and Stockmeyer    **/
40 /**                bipartitioning algorithm.               **/
41 /**                                                        **/
42 /**   DATES      : # Version 2.0  : from : 06 jun 1994     **/
43 /**                                 to     28 oct 1994     **/
44 /**                # Version 3.2  : from : 21 sep 1996     **/
45 /**                                 to     13 sep 1998     **/
46 /**                # Version 3.3  : from : 01 oct 1998     **/
47 /**                                 to     01 oct 1998     **/
48 /**                # Version 4.0  : from : 01 nov 2003     **/
49 /**                                 to     20 aug 2004     **/
50 /**                # Version 5.1  : from : 04 nov 2010     **/
51 /**                                 to     04 nov 2010     **/
52 /**                                                        **/
53 /************************************************************/
54 
55 /*
56 **  The type and structure definitions.
57 */
58 
59 /*+ Method parameters. +*/
60 
61 typedef struct BgraphBipartGpParam_ {
62   INT                       passnbr;              /*+ Number of passes to do +*/
63 } BgraphBipartGpParam;
64 
65 /*+ Complementary vertex structure. +*/
66 
67 typedef struct BgraphBipartGpVertex_ {
68   Gnum                      passnum;              /*+ Number of pass when vertex selected   +*/
69   Gnum                      distval;              /*+ Current distance from diameter vertex +*/
70 } BgraphBipartGpVertex;
71 
72 /*+ Neighbor queue. +*/
73 
74 typedef struct BgraphBipartGpQueue_ {
75   Gnum                      headnum;              /*+ Head of distance queue  +*/
76   Gnum                      tailnum;              /*+ Tail of distance queue  +*/
77   Gnum *                    queutab;              /*+ Array of queue elements +*/
78 } BgraphBipartGpQueue;
79 
80 /*
81 **  The function prototypes.
82 */
83 
84 #ifndef BGRAPH_BIPART_GP
85 #define static
86 #endif
87 
88 int                         bgraphBipartGp      (Bgraph * restrict const, const BgraphBipartGpParam * const);
89 
90 #undef static
91 
92 /*
93 **  The macro definitions.
94 */
95 
96 #define bgraphBipartGpQueueFlush(queue) ((queue)->headnum = (queue)->tailnum = 0)
97 #define bgraphBipartGpQueueEmpty(queue) ((queue)->headnum <= (queue)->tailnum)
98 #define bgraphBipartGpQueuePut(queue,vnum) ((queue)->queutab[(queue)->headnum ++] = (vnum))
99 #define bgraphBipartGpQueueGet(queue) ((queue)->queutab[(queue)->tailnum ++])
100