Last active
August 29, 2015 14:07
-
-
Save wanirepo/9350f5e35f0d284efb66 to your computer and use it in GitHub Desktop.
matlab function to build a adjacency matrix from a xy list
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 A = build_adjacency_from_list(ij) | |
% function A = build_adjacency_from_list(ij) | |
% | |
% ij: row, column | |
A = zeros(max(max(ij)),max(max(ij))); | |
for i = 1:length(ij) | |
A(ij(i,1), ij(i,2)) = 1; | |
end | |
if ~issymmetric(A) | |
A = A + A'; | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment