File: cs_sep.m

package info (click to toggle)
suitesparse 1%3A5.12.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 176,720 kB
  • sloc: ansic: 1,193,914; cpp: 31,704; makefile: 6,638; fortran: 1,927; java: 1,826; csh: 765; ruby: 725; sh: 529; python: 333; perl: 225; sed: 164; awk: 35
file content (20 lines) | stat: -rw-r--r-- 893 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function [s,as,bs] = cs_sep (A,a,b)
%CS_SEP convert an edge separator into a node separator.
%   [s,as,bs] = cs_sep (A,a,b) converts an edge separator into a node separator.
%   [a b] is a partition of 1:n, thus the edges in A(a,b) are an edge separator
%   of A.  s is the node separator, consisting of a node cover of the edges of
%   A(a,b).  as and bs are the sets a and b with s removed.
%
%   Example:
%       type cs_nsep ; % to see a simple example of use in cs_nsep.m
%
%   See also CS_DMPERM, CS_NSEP, CS_ESEP, CS_ND.

% Copyright 2006-2012, Timothy A. Davis, http://www.suitesparse.com

[p q r s cc rr] = cs_dmperm (A (a,b)) ;
s = [(a (p (1:rr(2)-1))) (b (q (cc(3):(cc(5)-1))))] ;
w = ones (1, size (A,1)) ;
w (s) = 0 ;
as = a (find (w (a))) ;                                                     %#ok
bs = b (find (w (b))) ;                                                     %#ok