Medians in median graphs and their cube complexes in linear time

Abstract

The median of a set of vertices PP of a graph GG is the set of all vertices xx of GG minimizing the sum of distances from xx to all vertices of PP. 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 1\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 GG satisfies the following fellow traveler property of independent interest: the parents of any two adjacent vertices of GG are also adjacent. Using the fast computation of the Θ\Theta-classes, we also compute the Wiener index (total distance) of GG in linear time and the distance matrix in optimal quadratic time

    Similar works

    Full text

    thumbnail-image

    Available Versions

    Last time updated on 08/01/2021