Choosing a neighbour at every vertex without mutual choices #
A function f : V → V with G.Adj u (f u) and f (f u) ≠ u for every vertex u chooses a
neighbour at every vertex so that no two vertices choose each other. Orienting each edge
{u, f u} away from u is then consistent, and every vertex is the tail of an edge: such a
choice is the same as an orientation of G in which no vertex is a sink.
A preconnected graph with a cycle admits such a choice: go once around the cycle, and send every other vertex to a neighbour strictly closer to the cycle. In a finite tree there is no such choice, since the choice would give the tree as many edges as vertices.
Main results #
SimpleGraph.exists_forall_adj_and_apply_apply_ne_of_forall_reachable: if the vertices of a setSalready choose neighbours inSwithout mutual choices, and every vertex can reachS, then the choice extends to all vertices.SimpleGraph.Walk.IsCycle.exists_forall_adj_and_apply_apply_ne: the vertices of a cycle choose their successors along it without mutual choices.SimpleGraph.Preconnected.exists_forall_adj_and_apply_apply_ne_of_not_isAcyclic: a preconnected graph which is not acyclic has a choice of neighbours without mutual choices.
Extending a choice of neighbours without mutual choices. Suppose that g chooses, at every
vertex of a set S, a neighbour in S, and that no two vertices of S choose each other. If every
vertex can reach S, then some f chooses a neighbour at every vertex, still without mutual
choices: it agrees with g on S and moves every other vertex strictly closer to S.
Going once around a cycle chooses neighbours without mutual choices. The vertices of a
cycle p have a choice g of neighbours on p such that no two of them choose each other: g
sends p.getVert i to p.getVert (i + 1).
A preconnected graph which is not acyclic has a choice of neighbours without mutual
choices: some f sends every vertex u to a neighbour f u with f (f u) ≠ u. Equivalently,
G has an orientation without sinks.