Adjacency matrices
An adjacency matrix is common way to represent links between nodes in a network. It's a square matrix with n rows and n columns representing the same nodes (vertices), where each element represents a link (edge) between nodes in one direction. With n2 elements, it can be used for directed graphs containing self-referencing loops. With all zeros on its diagonal, the remaining n*(n - 1) values represent a directed graph without loops (all edges connect different vertices). Undirected graphs (including trees) are represented by symmetric or triangular matrices with n*(n - 1) / 2 distinct values.
Networks are usually represented as weighted adjacency matrices, where each element not only reveals if the two nodes are connected ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access