InputEdge newEdge = new InputEdge(index, nodeFrom.getId(), nodeTo.getId());
if (!newEdges.contains(newEdge)) {
markAsDeleted(newEdge);
newEdges.add(newEdge);
graph.addEdge(newEdge);
} else {
newEdges.remove(newEdge);
graph.removeEdge(newEdge);
markAsSame(newEdge);
newEdges.add(newEdge);