Distance matrix is a by matrix that stores the weight of the edge defined by the source node to the target node.

Stores weight of edge. If no edge exist, distance is infinite. Cells where target node is the same as source node has value of 0

Notation

Weight matrix is commonly notated as .

Example

abcd
a0inf3inf
b20infinf
cinf701
d6infinf0