Computing critical nodes in directed graphs