Reverted inputs/outputs and check graph consistency before adding an edge