How to plot a graph of an adjacency matrix

A symmetric adjacency matrix like this can be used to create an undirected graph:

graph = [0 1 1 0 0;
         1 0 0 1 0;
         1 0 0 1 1;
         0 1 1 0 1;
         0 0 1 1 0]

To draw your (asymmetric) matrix, use a directed graph:

graph = [
    0  2  4  0  0  0 ; 
    0  0  1  7  0  0 ;
    0  0  0  0  3  0 ;
    0  0  0  0  0  1 ;
    0  0  0  2  0  5 ;
    0  0  0  0  0  0 ]

g = SimpleDiGraph(graph)
2 Likes