MATLAB: Plot directed graph from 2D matrix

graphgraph theoryMATLAB

Hi i want to know that how to plot a directed tree from a given 2d matrix. for example i have data in this from:
and i want to plot directed tree like this:
In which 2 4 5 6 are nodes (keeping 2 as root) and there will be an edge if value is other than zero. e.g. (2,4)=1
Thanks in advance

Best Answer

See graph() to construct a graph object, and then plot() the graph object to draw it.
Related Question