How does an adjacency matrix represent a weighted multigraph?

2.3k Views Asked by At

I heard that each element $a(i,j)$ of the matrix either represents the degree from vertex $i$ to vertex $j$ or does it represent the weight?

2

There are 2 best solutions below

0
On

This is a frivolous, totally impractical answer, but I thought of a way of representing a weighted multigraph in an adjacency matrix, so long as the weights are integers. Let us suppose that the weights must be positive integers. We represent an edge of weight $k$ by the $k$ prime, so an edge of weight $1$ corresponds to $2$, an edge of weight $2$ corresponds to $3$, an edge of weight $3$ corresponds to $5$, and so on. To represent the edges between two vertices, we just multiply all the corresponding primes. By unique factorization, we can recover the graph from the matrix. We could of course, extend this to integer weights by having $0$ correspond to $2$, $1$ to $3$, $-1$ to $5$, and so on.

Note that this works for pseudographs and also for directed, weighted multigraphs if we follow the convention that $a_{ij}$ represents the edges from vertex $i$ to vertex $j$.

1
On

I hope it can help you
A weighted multigraph $(G,w)$ is a multigraph with a weight-function $w : E(G) → \Bbb{F}\backslash\{0\} $where $\Bbb{F}$ is a field.
We always assume that a weighted multigraph has no parallel edges since all parallel edges $e_1, ..., e_k$ joining a pair of vertices $i$ and $j$ can be replaced by one edge $ij$ with weight $w(ij) =\sum w(e_i)$. The adjacency matrix of a weighted multigraph $(G,w)$, denoted by $\Bbb{A}_w$, is defined as $$(\Bbb{A}_w)_{ij}:=\begin{cases} w(ij), & \text{if $ij \in E(G)$} \\[2ex] 0 & \text{otherwise} \end{cases}$$ where loops, with $w(ii)\ne0 $ are allowed.$.^{[1]}$
for example: for the multigraph G
G:
enter image description here
the weighted adjacency matrix is $$A= \left[ \begin{array}{cc} 0&2&0\\ 2&0&1\\ 0&1&0 \end{array} \right] $$


1 Inverses of Bipartite Graphs Yujun Yang and Dong Ye