Lift common code from Digraph/Graph to BaseGraph