cs_reach.c
Go to the documentation of this file.
00001 #include "cs.h"
00002 /* xi [top...n-1] = nodes reachable from graph of G*P' via nodes in B(:,k).
00003  * xi [n...2n-1] used as workspace */
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) ;    /* check inputs */
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]))    /* start a dfs at unmarked node i */
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]) ;  /* restore G */
00018     return (top) ;
00019 }


hogman_minimal
Author(s): Maintained by Juergen Sturm
autogenerated on Mon Oct 6 2014 00:06:58