1function [s,as,bs] = cs_sep (A,a,b)
2%CS_SEP convert an edge separator into a node separator.
3%   [s,as,bs] = cs_sep (A,a,b) converts an edge separator into a node separator.
4%   [a b] is a partition of 1:n, thus the edges in A(a,b) are an edge separator
5%   of A.  s is the node separator, consisting of a node cover of the edges of
6%   A(a,b).  as and bs are the sets a and b with s removed.
7%
8%   Example:
9%       type cs_nsep ; % to see a simple example of use in cs_nsep.m
10%
11%   See also CS_DMPERM, CS_NSEP, CS_ESEP, CS_ND.
12
13% Copyright 2006-2012, Timothy A. Davis, http://www.suitesparse.com
14
15[p q r s cc rr] = cs_dmperm (A (a,b)) ;
16s = [(a (p (1:rr(2)-1))) (b (q (cc(3):(cc(5)-1))))] ;
17w = ones (1, size (A,1)) ;
18w (s) = 0 ;
19as = a (find (w (a))) ;                                                     %#ok
20bs = b (find (w (b))) ;                                                     %#ok
21