Go to the documentation of this file.00001 #include "cs.h"
00002
00003
00004 int cs_reach (cs *G, const cs *B, int k, int *xi, const int *pinv)
00005 {
00006 int p, n, top, *Bp, *Bi, *Gp ;
00007 if (!CS_CSC (G) || !CS_CSC (B) || !xi) return (-1) ;
00008 n = G->n ; Bp = B->p ; Bi = B->i ; Gp = G->p ;
00009 top = n ;
00010 for (p = Bp [k] ; p < Bp [k+1] ; p++)
00011 {
00012 if (!CS_MARKED (Gp, Bi [p]))
00013 {
00014 top = cs_dfs (Bi [p], G, top, xi, xi+n, pinv) ;
00015 }
00016 }
00017 for (p = top ; p < n ; p++) CS_MARK (Gp, xi [p]) ;
00018 return (top) ;
00019 }