Skip to content

Instantly share code, notes, and snippets.

@jcchurch
Created June 16, 2011 14:59
Show Gist options
  • Save jcchurch/1029414 to your computer and use it in GitHub Desktop.
Save jcchurch/1029414 to your computer and use it in GitHub Desktop.
Determine if a graph is symmetric
function yes = symmetric(g)
% Determins if an adjacency matrix
% is symmetric or not.
yes = 1;
[height width] = size(g);
if height ~= width
yes = 0;
end
for i = 1:height
for j = i+1:width
if g(i,j) ~= g(j,i)
yes = 0;
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment