EVSL  1.1.0 EigenValues Slicing Library
cs_reach.c
Go to the documentation of this file.
1 #include "cs.h"
2 /* xi [top...n-1] = nodes reachable from graph of G*P' via nodes in B(:,k).
3  * xi [n...2n-1] used as workspace */
4 CS_INT cs_reach (cs *G, const cs *B, CS_INT k, CS_INT *xi, const CS_INT *pinv)
5 {
6  CS_INT p, n, top, *Bp, *Bi, *Gp ;
7  if (!CS_CSC (G) || !CS_CSC (B) || !xi) return (-1) ; /* check inputs */
8  n = G->n ; Bp = B->p ; Bi = B->i ; Gp = G->p ;
9  top = n ;
10  for (p = Bp [k] ; p < Bp [k+1] ; p++)
11  {
12  if (!CS_MARKED (Gp, Bi [p])) /* start a dfs at unmarked node i */
13  {
14  top = cs_dfs (Bi [p], G, top, xi, xi+n, pinv) ;
15  }
16  }
17  for (p = top ; p < n ; p++) CS_MARK (Gp, xi [p]) ; /* restore G */
18  return (top) ;
19 }
#define CS_MARKED(w, j)
Definition: cs.h:657
#define cs
Definition: cs.h:637
#define CS_MARK(w, j)
Definition: cs.h:658
CS_INT cs_dfs(CS_INT j, cs *G, CS_INT top, CS_INT *xi, CS_INT *pstack, const CS_INT *pinv)
Definition: cs_dfs.c:3
#define CS_CSC(A)
Definition: cs.h:659
CS_INT cs_reach(cs *G, const cs *B, CS_INT k, CS_INT *xi, const CS_INT *pinv)
Definition: cs_reach.c:4
#define CS_INT
Definition: cs.h:627