Distance matrix

A distance matrix is somewhat like an adjacency matrix, but instead of simply showing whether two nodes in a network are connected, it provides information about the weight (e.g. distance) between them.

It’s a way of representing a network in a table, where both the rows and columns correspond to the nodes in the network.

Structure of a distance matrix

An adjacency matrix looks like this:

V1V2V3
V1-AB
V2A-C
V3BC-

Where:

The dashes in the graph above could also be replaced with 0s to indicate that the distance from a node to itself is zero.

Example

A distance matrix looks like this, for example:

ABCD
A052-
B50-1
C2-07
D-170

This would represent this network:

       2     
    A --- C  
  5 |     | 7
    B --- D  
       1