Given a weighted, undirected graph $G = (V,E)$, how can I compute the average weight of edges?
It seems an easy problem (divide the total weight to the number of edges!) but I couldn't manage to find the sum of the edge weights since each edge can be counted several times while iterating through the vertices.
2026-05-03 11:20:26.1777807226
How to compute the average weight of an undirected graph?
2.3k Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
1
When you iterate over the vertices you will count every edge $e=\{v,w\}$ exactly twice (once when you visit $v$ and once when you visit $w$).
Thus you can sum up all weights of incident edges for every vertex and divide the result by $2\cdot m$ (where m is the amount of edges) to get the average weight.