Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F121933393
mh.html
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Jul 14, 22:47
Size
2 KB
Mime Type
text/html
Expires
Wed, Jul 16, 22:47 (2 d)
Engine
blob
Format
Raw Data
Handle
27415270
Attached To
R1252 EMPoWER
mh.html
View Options
<!DOCTYPE HTML>
<html>
<head>
<meta
charset=
"UTF-8"
>
<title>
Computes the Metropolis-Hastings heuristic edge weights
</title>
<link
rel=
"canonical"
href=
"http://cvxr.com/cvx/examples/graph_laplacian/html/mh.html"
>
<link
rel=
"stylesheet"
href=
"../../examples.css"
type=
"text/css"
>
</head>
<body>
<div
id=
"header"
>
<h1>
Computes the Metropolis-Hastings heuristic edge weights
</h1>
Jump to:
<a
href=
"#source"
>
Source code
</a>
Text output
Plots
<a
href=
"../../index.html"
>
Library index
</a>
</div>
<div
id=
"content"
>
<a
id=
"source"
></a>
<pre
class=
"codeinput"
>
<span
class=
"keyword"
>
function
</span>
[w,rho] = mh(A)
<span
class=
"comment"
>
% [W,RHO] = MH(A) gives a vector of the Metropolis-Hastings edge weights
</span>
<span
class=
"comment"
>
% for a graphb described by the incidence matrix A (NxM). N is the number
</span>
<span
class=
"comment"
>
% of nodes, and M is the number of edges. Each column of A has exactly one
</span>
<span
class=
"comment"
>
% +1 and one -1. RHO is computed from the weights W as follows:
</span>
<span
class=
"comment"
>
% RHO = max(abs(eig( eye(n,n) - (1/n)*ones(n,n) - A*W*A' ))).
</span>
<span
class=
"comment"
>
%
</span>
<span
class=
"comment"
>
% The M.-H. weight on an edge is one over the maximum of the degrees of the
</span>
<span
class=
"comment"
>
% adjacent nodes.
</span>
<span
class=
"comment"
>
%
</span>
<span
class=
"comment"
>
% For more details, see the references:
</span>
<span
class=
"comment"
>
% "Fast linear iterations for distributed averaging" by L. Xiao and S. Boyd
</span>
<span
class=
"comment"
>
% "Fastest mixing Markov chain on a graph" by S. Boyd, P. Diaconis, and L. Xiao
</span>
<span
class=
"comment"
>
% "Convex Optimization of Graph Laplacian Eigenvalues" by S. Boyd
</span>
<span
class=
"comment"
>
%
</span>
<span
class=
"comment"
>
% Almir Mutapcic 08/29/06
</span>
<span
class=
"comment"
>
% degrees of the nodes
</span>
[n,m] = size(A);
Lunw = A*A';
<span
class=
"comment"
>
% unweighted Laplacian matrix
</span>
degs = diag(Lunw);
<span
class=
"comment"
>
% Metropolis-Hastings weights
</span>
mh_degs = abs(A)'*diag(degs);
w = 1./max(mh_degs,[],2);
<span
class=
"comment"
>
% compute the norm
</span>
<span
class=
"keyword"
>
if
</span>
nargout
>
1,
rho = norm( eye(n) - A*diag(w)*A' - (1/n)*ones(n) );
<span
class=
"keyword"
>
end
</span>
</pre>
</div>
</body>
</html>
Event Timeline
Log In to Comment