public void AddEdge(Node from, Node to, int inputIndex, int fromIndex) { from.AddChild(to, inputIndex, fromIndex); to.AddParent(from); List<Node> cycle = CheckForCycle.CreatesCycle(to); if (cycle != null) { // remove edge which introduced cycle // RemoveEdge( from, to ); String msg = "Edge between '" + from.Name + "' and '" + to.Name + "' introduces a cycle in the graph"; GraphCompilationStatus.HandleError(new HasCycleException(msg, cycle)) ; } }
public void AddEdge(Node from, Node to, int inputIndex, int fromIndex) { from.AddChild(to, inputIndex, fromIndex); to.AddParent(from); List <Node> cycle = CheckForCycle.CreatesCycle(to); if (cycle != null) { // remove edge which introduced cycle // RemoveEdge( from, to ); String msg = "Edge between '" + from.Name + "' and '" + to.Name + "' introduces a cycle in the graph"; GraphCompilationStatus.HandleError(new HasCycleException(msg, cycle)); } }