Planted partition can be intuitively regarded as, literally, separating a graph according to your plan. The problems such as bisection, k-coloring and maximum clique are known to be hard, and actually, most problems are hard unless proven easy.
In this post, we firstly try to classify the spectral graph model, and then given out the matlab code for partitioning a bipartite graph.
A general model for structural graph is:
: let
which meaning the mapping from vertices to classes, and
be its generating matrix of size
, where
. So the connecting probability of any edge
is
.
So the weighted adjacency matrix of looks like
,
where the symmetric property of this matrix descents from that it is an in-directed graph.
We further specialize the bisection model hereby
- Planted Bisection
: the connecting probability of connecting to its own section is
and
respectively, while that of crossing is
.
Suppose we are now given a graph of this form, and want to simulate the process of partitioning all these nodes into two sections, with least possible crossing edges. Before delving into those technical details, we briefly describe a spectral partitioning principle for our simulation in this post:
The eigenvector of the second largest eigenvalue of the adjacency matrix
is a slightly perturbed version of its generator matrix
, which is of the form
.
Now we run a MATLAB simulation to simulate how that spectral partitioning method works.
- Generate a graph with
vertexes, and
vertexes are connecting each other with probability
, while the other
vertexes are self connecting with probability
. And that of their crossing is
.
clc;clear all; n=800; x=randperm(n);%put the sets among random positions n_1=round(n/4); ind_set1=x(1:n_1); ind_set2=x(n_1+1:end); p_1=0.8; p_2=0.8; q=0.001; A(ind_set1,ind_set1)=rand(n_1,n_1)<p_1; A(ind_set2,ind_set2)=rand(n-n_1,n-n_1)<p_2; A(ind_set1,ind_set2)=rand(n_1,n-n_1)<q; A(ind_set2,ind_set1)=rand(n-n_1,n_1)<q; A=triu(A,1);%to make the adjacency matrix symmetric A=A+A'; figure(1) spy(A);
When this graph is generated, we can hardly tell any relation among its connection according to figure 1.
Again, we should bear in mind that the second eigenvector of
is a perturbed version of
of the generator matrix
. (means the values of
are just a little deviated from
) And why is
this important? because it is of the form
, which reflects the relation of all these vertexes. So our second step of the code is
- Get the second eigenvector of
, and re-sort the positions of these
vertexes.
[V D] = eigs(A, 2); [useless ind_recover] = sort(V(:,2)); A_hat=A(ind_recover,ind_recover); figure(2) spy(A_hat);
Then we can see from figure 2 below that the relation it reflects is really a bisection.
References:
1. Daniel A. Spielman, “Spectral partitioning in the planted partition model”, Lecture notes(Lecture 21), 2009.
2. Frank McSherry, “Spectral partitioning of random graphs”, STOC, 2001.
3. David Gleich, “Spectral Graph Partitioning and the Laplacian with Matlab”, 2006. (Online resources)