Created
June 16, 2011 14:59
-
-
Save jcchurch/1029414 to your computer and use it in GitHub Desktop.
Determine if a graph is symmetric
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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