Question #6733   Submitted by Answiki on 09/25/2022 at 09:06:25 AM UTC

How to visualize a directed graph from its adjacency matrix on Matlab?

Answer   Submitted by Answiki on 09/25/2022 at 08:54:01 AM UTC

The digraph() Matlab function creates a directed graphs object (directional edges connecting the nodes). The following example plot a directed graph from the adjacency matrix :

% Adjacency matrix
A = [ 0 1 0 1 ; 
      1 0 1 1 ;
      0 1 1 1 ;
      0 0 0 1 ];

% Create directed graph object
G = digraph(A);

% Plot directed graph
p=plot(G, 'MarkerSize', 10);

The above code displays the following figure:

9 events in history
Question by Answiki 09/25/2022 at 09:06:25 AM
How to visualize a directed graph from its adjacency matrix on Matlab?
Question by Answiki 09/25/2022 at 09:06:09 AM
How to visualize a directed graph on Matlab?
Answer by Answiki on 09/25/2022 at 08:54:01 AM

The digraph() Matlab function creates a directed graphs object (directional edges connecting the nodes). The following example plot a directed graph from the adjacency matrix :

% Adjacency matrix
A = [ 0 1 0 1 ; 
      1 0 1 1 ;
      0 1 1 1 ;
      0 0 0 1 ];

% Create directed graph object
G = digraph(A);

% Plot directed graph
p=plot(G, 'MarkerSize', 10);

The above code displays the following figure:

Question by Answiki 09/25/2022 at 08:47:48 AM
How to draw directed graph from adjacency matrix with Matlab?
Question by Answiki 09/25/2022 at 08:47:34 AM
How to plot directed graph from adjacency matrix with Matlab?
Answer by Answiki on 09/25/2022 at 08:47:25 AM

The digraph() Matlab function creates a directed graphs object (directional edges connecting the nodes). The following example plot a directed graph from the adjacency matrix :

% Adjacency matrix
A = [ 0 1 0 1 ; 
      1 0 1 1 ;
      0 1 1 1 ;
      0 0 0 1 ];

% Create directed graph object
G = digraph(A);

% Plot directed graph
p=plot(G, 'MarkerSize', 10);

The above code displays the following figure:


Question by Answiki 09/25/2022 at 08:47:19 AM
How to plot directed graph from adjacency matrix on Matlab?
Answer by Answiki on 09/25/2022 at 08:46:53 AM

The digraph() Matlab function creates a directed graphs object (directional edges connecting the nodes). The following example plot a directed graph from the adjcency matrix :

% Adjacency matrix
A = [ 0 1 0 1 ; 
      1 0 1 1 ;
      0 1 1 1 ;
      0 0 0 1 ];

% Create directed graph object
G = digraph(A);

% Plot directed graph
p=plot(G, 'MarkerSize', 10);

The above code displays the following figure:


Question by Answiki 09/25/2022 at 08:36:26 AM
How to plot directed graph on Matlab?
# ID Query URL Count

Icons proudly provided by Friconix.