Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Basic graph formalization

A network is commonly represented as a graph G=(V,E)G=(V,E), where VV is the set of nodes and EE is the set of edges.

Adjacency matrix

The adjacency matrix AA stores whether an edge exists between each pair of nodes:

Aij={1if there is an edge from i to j0otherwiseA_{ij}= \begin{cases} 1 & \text{if there is an edge from } i \text{ to } j \\ 0 & \text{otherwise} \end{cases}

The adjacency matrix requires n2n^2 space, but it allows constant-time edge lookup and makes linear algebra tools directly applicable.

One key relation is

Av=λvAv=\lambda v

where λ\lambda is an eigenvalue and vv is the corresponding eigenvector.

Adjacency list

The adjacency list representation stores, for each node, the set of its neighbors. It is more space-efficient for sparse graphs and typically requires n+2mn + 2m space in an undirected graph because each edge is recorded twice.

Directed and weighted graphs

For a directed graph,

Aij=1A_{ij}=1

means there is an edge iji \rightarrow j.

The number of incoming edges to node vv is its in-degree, and the number of outgoing edges is its out-degree.

In weighted graphs, edges carry magnitudes rather than just binary presence. In undirected weighted networks, the strength of node ii is

si=jwijs_i=\sum_j w_{ij}

In directed weighted networks, we distinguish in-strength and out-strength.