mp3: Corrections
This commit is contained in:
parent
aa9eb03131
commit
7690f4b23d
6 changed files with 11 additions and 9 deletions
Binary file not shown.
|
@ -74,7 +74,7 @@ for c = 1:nc
|
||||||
A = params.Adj;
|
A = params.Adj;
|
||||||
coords = params.coords;
|
coords = params.coords;
|
||||||
|
|
||||||
W = A - diag(diag(A));
|
W = A;
|
||||||
|
|
||||||
% 2. Recursive routines
|
% 2. Recursive routines
|
||||||
% i. Spectral
|
% i. Spectral
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
function [part1,part2] = bisection_inertial(A,xy,picture)
|
function [part1,part2] = bisection_inertial(A,xy,picture)
|
||||||
% INERTPART : Inertial partition of a graph.
|
% INERTPART : Inertial partition of a graph.
|
||||||
%
|
%
|
||||||
% p = inertpart(A,xy) returns a list of the vertices on one side of a partition
|
% p = inertpart(A,xy) returns a list of the vertices on one side of a partition
|
||||||
|
@ -20,7 +20,7 @@ function [part1,part2] = bisection_inertial(A,xy,picture)
|
||||||
|
|
||||||
% Steps
|
% Steps
|
||||||
% 1. Calculate the center of mass.
|
% 1. Calculate the center of mass.
|
||||||
m = sum(xy, 1) / size(xy, 1);
|
m = sum(xy, 1) ./ size(xy, 1);
|
||||||
xm = m(1);
|
xm = m(1);
|
||||||
ym = m(2);
|
ym = m(2);
|
||||||
|
|
||||||
|
|
|
@ -18,9 +18,9 @@ function [part1,part2] = bisection_spectral(A,xy,picture)
|
||||||
% Steps
|
% Steps
|
||||||
|
|
||||||
% 1. Construct the Laplacian.
|
% 1. Construct the Laplacian.
|
||||||
[i, j, ~] = find(triu(A));
|
D = diag(sum(A, 1));
|
||||||
G = graph(i, j);
|
W = -1 .* A;
|
||||||
L = laplacian(G);
|
L = D + W;
|
||||||
|
|
||||||
% 2. Calculate its eigensdecomposition.
|
% 2. Calculate its eigensdecomposition.
|
||||||
[V, ~] = eigs(L,2,'smallestabs');
|
[V, ~] = eigs(L,2,'smallestabs');
|
||||||
|
|
|
@ -7,6 +7,8 @@ addpaths_GP;
|
||||||
[W4,c4] = gridt(40);
|
[W4,c4] = gridt(40);
|
||||||
[W5,c5] = grid9(30);
|
[W5,c5] = grid9(30);
|
||||||
|
|
||||||
|
global W
|
||||||
|
global c
|
||||||
W = {W1, W2, W3, W4, W5, Smallmesh, Tapir, Eppstein};
|
W = {W1, W2, W3, W4, W5, Smallmesh, Tapir, Eppstein};
|
||||||
c = {c1, c2, c3, c4, c5, Smallmesh_coords, Tapir_coords, Eppstein_coords};
|
c = {c1, c2, c3, c4, c5, Smallmesh_coords, Tapir_coords, Eppstein_coords};
|
||||||
|
|
||||||
|
@ -24,8 +26,8 @@ function runtest(implementation)
|
||||||
global W
|
global W
|
||||||
global c
|
global c
|
||||||
for i=1:8
|
for i=1:8
|
||||||
out = implementation(W{i}, c{i});
|
[part1, ~] = implementation(W{i}, c{i});
|
||||||
ne = cutsize(W{i},out);
|
ne = cutsize(W{i},part1);
|
||||||
fprintf('%d\t', ne);
|
fprintf('%d\t', ne);
|
||||||
end
|
end
|
||||||
fprintf('\n');
|
fprintf('\n');
|
||||||
|
|
|
@ -11,4 +11,4 @@ bisection_spectral(Smallmesh, Smallmesh_coords, 2);
|
||||||
|
|
||||||
figure;
|
figure;
|
||||||
bisection_spectral(Eppstein, Eppstein_coords, 2);
|
bisection_spectral(Eppstein, Eppstein_coords, 2);
|
||||||
%matlab2tikz( '../../ex3_eppstein.tex');
|
%matlab2tikz('../../ex3_eppstein.tex');
|
Reference in a new issue