graph: make ahead_behind() detect and return if a common ancestor exists

Beside being handy to display the `ahead_by` and `behind_by` counts of two branches, this should help indicate if they share a common common ancestor.