Lenmatrix
Lenmatrix, or length matrix, is a matrix representation that records the shortest-path lengths between all pairs of vertices in a weighted graph. It abstracts the concept of distance in a network, providing a single data structure from which various analyses can be performed.
Formally, for a graph G=(V,E,w) with n=|V| vertices, the lenmatrix L is an n×n matrix where the
Computation: L can be obtained by running the Floyd-Warshall algorithm in O(n^3) time, or by running Dijkstra's
Variants and relation: Lenmatrix is closely related to the distance matrix used in graph theory. In practice,
Properties: All entries are nonnegative; diagonal elements are zero; L[i][j] ≤ L[i][k] + L[k][j] (triangle inequality). For disconnected
Applications: The lenmatrix supports routing optimizations, clustering and community detection, network reliability analysis, and centrality measures
Example: A simple graph with four vertices A,B,C,D and weighted edges A-B=2, B-C=4, C-D=2, A-D=7 yields the