# Medians in median graphs and their cube complexes in linear time

**Authors:** Laurine B\'en\'eteau, J\'er\'emie Chalopin, Victor Chepoi, Yann, Vax\`es

arXiv: 1907.10398 · 2022-03-03

## TL;DR

This paper introduces linear time algorithms for computing medians in median graphs and their associated cube complexes, significantly improving efficiency over previous methods and leveraging the structure of median graphs.

## Contribution

The paper presents the first linear time algorithms for median computation in median graphs and their cube complexes, utilizing LexBFS and the majority rule characterization.

## Key findings

- Median computation time reduced from quadratic to linear
- Wiener index computed in linear time
- Distance matrix computed in quadratic time

## Abstract

The median of a set of vertices $P$ of a graph $G$ is the set of all vertices $x$ of $G$ minimizing the sum of distances from $x$ to all vertices of $P$. In this paper, we present a linear time algorithm to compute medians in median graphs, improving over the existing quadratic time algorithm. We also present a linear time algorithm to compute medians in the $\ell_1$-cube complexes associated with median graphs. Median graphs constitute the principal class of graphs investigated in metric graph theory and have a rich geometric and combinatorial structure, due to their bijections with CAT(0) cube complexes and domains of event structures. Our algorithm is based on the majority rule characterization of medians in median graphs and on a fast computation of parallelism classes of edges ($\Theta$-classes or hyperplanes) via Lexicographic Breadth First Search (LexBFS). To prove the correctness of our algorithm, we show that any LexBFS ordering of the vertices of $G$ satisfies the following fellow traveler property of independent interest: the parents of any two adjacent vertices of $G$ are also adjacent. Using the fast computation of the $\Theta$-classes, we also compute the Wiener index (total distance) of $G$ in linear time and the distance matrix in optimal quadratic time.

## Full text

_Full body text omitted from this summary view._ Fetch the complete paper as Markdown: https://tomesphere.com/paper/1907.10398/full.md

## Figures

32 figures with captions in the complete paper: https://tomesphere.com/paper/1907.10398/full.md

## References

79 references — full list in the complete paper: https://tomesphere.com/paper/1907.10398/full.md

---
Source: https://tomesphere.com/paper/1907.10398