public void RemoveNodeNotInGraphFromGraph() { Graph graph = new Graph(1); Node a = new Node("a"); Node b = new Node("b"); graph.AddNode(a); Assert.IsFalse(graph.RemoveNode(b)); }
public void RemoveNodeInGraphFromGraph() { Graph actual = new Graph(1); Graph expected = new Graph(1); Node a = new Node("a"); Node b = new Node("b"); actual.AddNode(a); actual.AddNode(b); actual.RemoveNode(b); expected.AddNode(a); Assert.IsTrue(actual.Equals(expected)); }
public void RemoveNodeWithEdgesInGraphFromGraph() { Graph actual = new Graph(1); Graph expected = new Graph(1); Node a = new Node("a"); Node b = new Node("b"); Edge ab = new Edge(2); actual.AddNode(a); actual.AddNode(b); actual.AddUndirectedEdge(new Tuple<Node, int>(a, 0), new Tuple<Node, int>(b, 0), ab); actual.RemoveNode(b); expected.AddNode(a); Assert.IsTrue(actual.Equals(expected)); }
public void TwoGraphWithTwoNodeOneRemoved() { Graph g1 = new Graph(1); Graph g2 = new Graph(2); Node a = new Node("a"); Node b = new Node("b"); Node c = new Node("b"); g1.AddNode(a); g1.AddNode(b); g1.AddNode(c); g1.RemoveNode(c); g2.AddNode(a); g2.AddNode(b); g2.AddNode(c); g2.RemoveNode(c); Assert.IsFalse(g1.Equals(g2)); }