How to build an adjacency matrix?

6 Ansichten (letzte 30 Tage)
Isidro Pantoja-Gomez
Isidro Pantoja-Gomez am 16 Mai 2017
Beantwortet: Walter Roberson am 16 Mai 2017
I have a matrix of thirty rows and 2 columns how do I put this data into an adjacency matrix of 12x12. So that the new matrix has zeros where there is no point an a 1 where there is a match in the first matrix.

Antworten (1)

Walter Roberson
Walter Roberson am 16 Mai 2017
G = graph( YourMatrix(:,1), YourMatrix(:,2) );
and then if you still need it,
adjacency(G)

Kategorien

Mehr zu Graph and Network Algorithms finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by