/// <summary> /// Removes the node with the specified number from the Graph. /// </summary> /// <param name="nodeNumber">The number of node to remove.</param> /// <exception cref="KeyNotFoundException">node to remove is not in the Graph.</exception> public void RemoveNode(int nodeNumber) // Validated { List <Line> Lines = new List <Line>(); foreach (Line line in LinesList.Values) { if ((line.FirstNode.NodeNumber == nodeNumber) || (line.SecondNode.NodeNumber == nodeNumber)) { //RemoveLine(line.LineName); //line.Deleted = true; Lines.Add(line); } } for (int i = 0; i < Lines.Count; i++) { LinesList.Remove(Lines[i].LineName); } NodesList.Remove(nodeNumber); //SetTheConnectionAndStartArray(); }
/// <summary> /// Removes the line with the specified name from the Graph. /// </summary> /// <param name="lineName">The name of the line to remove.</param> /// <exception cref="ArgumentNullException">lineName is Null.</exception> /// <exception cref="KeyNotFoundException">line to remove is not in the Graph.</exception> public void RemoveLine(string lineName) { ValidateArgumentIsNotNull(lineName); LinesList.Remove(lineName); SetTheConnectionAndStartArray(); }