contraction with respect to a directed graph