/
metisdice.m
38 lines (35 loc) · 1006 Bytes
/
metisdice.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
function map = metisdice(A,a,b);
% METISDICE : Metis multiway partition.
%
% map = metisdice(A,nparts)
% A is the adjacency matrix of a graph.
% This uses Metis to divide A into nparts pieces of approximately
% equal size, with relatively small connections.
%
% gsdice(A,nparts,xy) or
% gsdice(A,xy,nparts): Draw a picture of the result, as well.
%
% See also METISMEX (which accepts all the Metis options),
% GEODICE, GSDICE, SPECDICE, METISPART, METISND.
%
% John Gilbert 3 Jul 01
% Copyright (c) 1990-2001 by Xerox Corporation. All rights reserved.
% HELP COPYRIGHT for complete copyright and licensing notice.
% Sort out the input arguments.
picture = (nargin >= 3);
if picture
if length(a) == 1
nparts = a;
xy = b;
else
nparts = b;
xy = a;
end;
else
nparts = a;
end;
map = metismex('PartGraphKway',A,nparts);
if picture
gplotmap(A,xy,map);
title('Metis Multiway Partition');
end;