genrcmi() (or genrcml() if you use long integers to store your graph information). The way genrcmi()/genrcml() works can be adjusted by setting the flags parameter. In most cases the `default' behavior will be just fine and the caller just sets flags to 0. Specific flags can be set by using the constants defined in rcm.h. Multiple flags are combined by binary or (the `|' operator in C). genrcmi() should work on is passed in the form of the three parameters n, xadj and adj. The graph is expected to be stored in a compressed format similar to the compressed sparse row/column formats for matrices. genrcmi(). The new ordering is stored in the caller-provided vector perm, i.e., perm[p] is the node to become node p after the permutation is actually applied to the graph.
On default, genrcmi()/ indices to be zero based (as in C) and not one based (as in Fortran). This applies to xadj, adj and mask on input (to mask on input only if the genrcml() expectsRCM_USE_MASK flag is set) and to perm, mask and deg on ouput. If your data is one based (like in Fortran), set the RCM_FORTRAN_INDICES flag.
Further details can be found at the documentation for genrcmi().
genrcmi()/genrcml(), two subroutines are declared non-static, i.e., can be used from outside of rcm.c. For more details we refer to the linked detail documentation of these functions. fnrooti() finds a pseudo-peripheral node (starting at any given node in the component) and rcmi() finds the RCM ordering, based on a given root for the rooted level set structure.
Definition in file rcm.h.
Go to the source code of this file.
Defines | |
| #define | RCM_FORTRAN_INDICES 1 |
| Use Fortran style array indices. The default is to use C style (zero based) indices. | |
| #define | RCM_C_INDICES 2 |
| Use C style array indices. This is the default setting. | |
| #define | RCM_NO_SORT 4 |
| Do not use any sorting in the Cuthill-McKee algorithm. The default is to sort the nodes newly added to a level set from the same adjacency list by non-decreasing degree. | |
| #define | RCM_INSERTION_SORT 8 |
| Use linear insertion sort instead of heapsort. | |
| #define | RCM_NO_REVERSE 16 |
| Compute just a Cuthill-McKee ordering and skip the reversal. | |
| #define | RCM_USE_MASK 32 |
| Use the values found in the mask arrays to filter vertices of the graph. Work only on nodes with a non-zero mask value. | |
| #define | RCM_PREFIX |
Common prefix to be used for all functions declared in rcm.h, defaults to an empty definition (i.e., no prefix). | |
Functions | |
| void | genrcmi (const int n, const int flags, const int *xadj, const int *adj, int *perm, signed char *mask, int *deg) |
| Find the reverse Cuthill-McKee ordering for the graph provided in xadj and adj. | |
| void | genrcml (const long n, const int flags, const long *xadj, const long *adj, long *perm, signed char *mask, long *deg) |
Version of genrcmi() for long data. | |
| void | fnrooti (int *root, const int flags, const int *xadj, const int *adj, const int *deg, int *ccsize, signed char *mask, int *ls) |
| Find a pseudo-peripheral node for the subgraph specified by root. | |
| void | fnrootl (long *root, const int flags, const long *xadj, const long *adj, const long *deg, long *ccsize, signed char *mask, long *ls) |
Version of fnrooti() for long data. | |
| void | rcmi (const int root, const int flags, const int *xadj, const int *adj, const int *deg, signed char *mask, int *perm, int *ccsize) |
| Find a reverse Cuthill-McKee ordering of the connected component specified by root. | |
| void | rcml (const long root, const int flags, const long *xadj, const long *adj, const long *deg, signed char *mask, long *perm, long *ccsize) |
Version of rcmi() for long data. | |
|
|
Fortran and C/C++ use different array indexing. In Fortran indices are based on one, in C on zero. This means the first element in an array has index 1 in Fortran and index 0 in C.
If the
Definition at line 101 of file rcm.h. Referenced by DEGREE(), FNROOT(), GENRCM(), GENRCM2(), RCM(), and ROOTLS(). |
|
|
Using C style array indices is the default and there is no need to specify it. Of the two indexing related flags (
The main purpose of
Definition at line 121 of file rcm.h. Referenced by GENRCM2(). |
|
|
In the Cuthill-McKee algorithm we construct a level set by scanning through the previous one. Adjacent nodes not yet used in this or any prior level set are added to the new one. The nodes added from the same level set are ordered by their degree. This sorting is suppressed if the Definition at line 136 of file rcm.h. Referenced by RCM(). |
|
|
Changing the sorting routine does not only change the execution time, but can also change the permutation found. This is due to the fact that heapsort is not stable, i.e. nodes with the same degree may be exchanged by heapsort. On the other hand insertion sort kepp such nodes in their original order. Heapsort was choosen as the default sorting algorithm because it is much faster in the worst case and there are also real word examples showing a significant improvement in execution time over insertion sort. Finding a (symmetric) RCM ordering of the Stanford Web Matrix is more than 15 times faster if heapsort is used instead of insertion sort.
The SPARSPAK implementation of RCM uses linear insertion sort and hence the Definition at line 163 of file rcm.h. Referenced by RCM(). |
|
|
Common prefix to be used for all functions declared in |
|
||||||||||||||||||||||||||||||||
|
Find the reverse Cuthill-McKee ordering for the graph provided in xadj and adj. For each component of the graph
|
|
||||||||||||||||||||||||||||||||||||
|
Find a pseudo-peripheral node for the subgraph specified by root.
|
|
||||||||||||||||||||||||||||||||||||
|
Find a reverse Cuthill-McKee ordering of the connected component specified by root. The numbering process is to be started at the node root.
|
1.4.3-20050530