# Graphic Representation of a Adjacency Matrix Example

In mathematics and computer science, an adjacency matrix is a means of representing which vertices (or nodes) of a graph are adjacent to which other vertices.

## Symmetric Matrix

The adjacency matrix of an undirected simple graph is symmetric.

```
1 from numpy import *
2 from iaadjmxtcreate import iaadjmxtcreate
3
4 a = float('inf')
5 A = array( [ (1,1,a,a,1,a),
6 (1,a,1,a,1,a),
7 (a,1,a,1,a,a),
8 (a,a,1,a,1,1),
9 (1,1,a,1,a,a),
10 (a,a,a,1,a,a) ] )
11 mmgraphviz(iaadjmxtcreate(A), title='Graphic Representation of a symmetric Adjacency Matrix')
```

## Non-symmetric matrix

```
1 a = float('inf')
2 A = array( [ (1,a,a,a,1),
3 (1,a,1,a,1),
4 (1,a,a,1,a),
5 (a,1,a,a,1),
6 (1,a,a,1,a)] )
7 mmgraphviz(iaadjmxtcreate(A), title='Graphic Representation of a Non-symmetric Adjacency Matrix')
```

## Complete graph

In the mathematical field of graph theory, a complete graph is a simple undirected graph in which every pair of distinct vertices is connected by a unique edge.

```
1 a = float('inf')
2 matrix = array( [ (a,1,1),
3 (1,a,1),
4 (1,1,a)] )
5 mmgraphviz(iaadjmxtcreate(matrix), title='Complete Graphic Representation')
6
7 A = ones((10,10))
8 mmgraphviz(iaadjmxtcreate(A), title='10-Vertices Complete Graph')
```

## Weighted symmetric graph

The distance matrix has in position (i,j) the distance between vertices vi and vj.

```
1 a = float('inf')
2 matrix = array( [ (a,2,3),
3 (2,a,1),
4 (3,1,5)] )
5 mmgraphviz(iaadjmxtcreate(matrix,True), title='Weighted Symmetric Graph')
```

## Empty graph

In the mathematical field of graph theory, the null graph may refer either to the order zero graph, or alternatively, to any edgeless graph (the latter is sometimes called an empty graph).

```
1 a = float('inf')
2 matrix = array( [ (a,a,a),
3 (a,a,a),
4 (a,a,a)] )
5 mmgraphviz(iaadjmxtcreate(matrix), title='Empty Graph')
```