Layer-cake representation (source code)

= Layer-cake representation
{wiki=Layer_cake_representation}

For a nonnegative measurable function $g$,
$$
\int g=\int_0^\infty\mu\{g>t\}\,dt.
$$
On a graph, applying this identity to $|g(x)-g(y)|$ expresses its total variation as the integral of the edge boundaries of the superlevel sets.