Question #6735
Submitted by

**Answiki**on 09/25/2022 at 09:10:27 AM UTC# How to plot undirected graph with Matlab?

Merged questions

Answer
Submitted by

**Answiki**on 09/25/2022 at 09:00:24 AM UTCThe `graph()`

Matlab function creates an undirected graphs object (edges connecting the nodes). The following example plot an undirected graph from the adjacency matrix :

```
% Adjacency matrix
A = [ 0 1 1 1 ;
1 1 0 0 ;
1 0 1 1 ;
1 0 1 0 ];
% Create undirected graph object
G = graph(A);
% Plot graph
p=plot(G, 'MarkerSize', 10);
```

Note that the adjacency matrix must be symmetrical. The above code displays the following figure:

Question by

**Answiki**09/25/2022 at 09:10:27 AM
How to plot undirected graph with Matlab?

Question by

**Answiki**09/25/2022 at 09:05:45 AM
How to visualize an undirected graph from its adjacency matrix with Matlab?

Answer by

**Answiki**on 09/25/2022 at 09:00:24 AMThe `graph()`

Matlab function creates an undirected graphs object (edges connecting the nodes). The following example plot an undirected graph from the adjacency matrix :

```
% Adjacency matrix
A = [ 0 1 1 1 ;
1 1 0 0 ;
1 0 1 1 ;
1 0 1 0 ];
% Create undirected graph object
G = graph(A);
% Plot graph
p=plot(G, 'MarkerSize', 10);
```

Note that the adjacency matrix must be symmetrical. The above code displays the following figure:

Question by

**Answiki**09/25/2022 at 08:57:58 AM
How to draw undirected graph from adjacency matrix with Matlab?

# | ID | Query | URL | Count |
---|

Icons proudly provided by Friconix.