File Exchange

image thumbnail


version (2.2 KB) by Ondrej
Conversion from graph incidence matrix to adjacency matrix.

1 Download

Updated 25 Feb 2016

View Version History

View License

Returns a sparse adjacency matrix 'mAdj' according to the incidence matrix 'mInc'. The rows in the incidence matrix must represent the edges, while the columns the vertices.
Function can handle directed graphs with incidence matrix containing -1s, indicating an "in-going" edge, and 1s indicating an "out-going" edge.

Cite As

Ondrej (2021). inc2adj(mInc) (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (3)

Mohammad Al Khalaf

doesnt work


I don't quite understand what kind of problem you had, Muhammad. The function should return normal adjacency matrix and not adjacency list. Could you please provide some example and the expected result you would want? And of course, if you noticed some incorrect behaviour, I would gladly fix it.

Muhammad Shafique

It was of great help. Thanks! Being occasional user of Matlab, however, the ideal output for me would have been a matrix, or at least some properly delimited list. I had a hard time converting the output into proper adjacency matrix I needed. This was due to different number of spaces before, within, and after each element. It would be great if the output is in the form 1,2,3 with no spaces anywhere. I used Matlab7.10 (R2010a).

MATLAB Release Compatibility
Created with R2009b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!