Extended relabel() to directed graphs