Created
November 25, 2017 14:26
-
-
Save import-benjamin/eb8a64ce2f82663ce69a3f6541f1aa3b to your computer and use it in GitHub Desktop.
graph theory : convert adjency list to matrix in scilab
This file contains 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
// desc : retourne une liste d'adjacence sous forme de matrice | |
// input : liste d'adjacence (S, T) | |
// output : matrice (MS) | |
function MS=listes2mat (S, T) | |
nbSommets = length(T)-1 // le nombre de sommets | |
MS = zeros(nbSommets, nbSommets) // on initialise une matrice d'adjacence vide | |
for k=1:nbSommets | |
MS(k, liste_succ(S,T,k)) = 1 | |
end | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment