Median algebra

In mathematics, a median algebra is a set with a ternary operation formula_1 satisfying a set of axioms which generalise the notion of median or majority function, as a Boolean function.
The axioms are 
The second and third axioms imply commutativity: it is possible (but not easy) to show that in the presence of the other three, axiom (3) is redundant. The fourth axiom implies associativity.
There are other possible axiom systems: for example the two
also suffice.
In a Boolean algebra, or more generally a distributive lattice, the median function formula_8 satisfies these axioms, so that every Boolean algebra and every distributive lattice forms a median algebra.
Birkhoff and Kiss showed that a median algebra with elements formula_9 and formula_10 satisfying formula_11 is a distributive lattice.
Relation to median graphs.
A median graph is an undirected graph in which for every three vertices formula_12, formula_13, and formula_14 there is a unique vertex formula_1 that belongs to shortest paths between any two of formula_12, formula_13, and formula_14. If this is the case, then the operation formula_1 defines a median algebra having the vertices of the graph as its elements.
Conversely, in any median algebra, one may define an "interval" formula_20 to be the set of elements formula_13 such that formula_22. One may define a graph from a median algebra by creating a vertex for each algebra element and an edge for each pair formula_23 such that the interval formula_20 contains no other elements. If the algebra has the property that every interval is finite, then this graph is a median graph, and it accurately represents the algebra in that the median operation defined by shortest paths on the graph coincides with the algebra's original median operation.