Transit functions on graphs (and posets)