Code covered by the BSD License  

Highlights from
Cops and Robber Software

from Cops and Robber Software by Athanasios Kehagias
Functions to compute optimal schedules for a team of cops chasing a robber on a graph

P=grf2P01(fname)
function P=grf2P01(fname)
% function P=grf2P01
% create transition matrix P for RW on grf G
% G is given as an edge list read from fname

edges=load(fname);

M=size(edges,1);
N=max(max(edges));
P=zeros(N,N);
for m=1:M
	n1=edges(m,1);
	n2=edges(m,2);
	P(n1,n2)=1;
	P(n2,n1)=1;
end
for n=1:N
	P(n,:)=P(n,:)/sum(P(n,:));
end

Contact us