public void TestRemoveEdges() { var graph = new DirectedMetaGraph(1, 1, 10); // add and remove edge. graph.AddEdge(0, 1, 1, 100); Assert.AreEqual(0, graph.RemoveEdges(1)); Assert.AreEqual(1, graph.RemoveEdges(0)); // verify all edges. var edges = graph.GetEdgeEnumerator(0); Assert.AreEqual(0, edges.Count()); edges = graph.GetEdgeEnumerator(1); Assert.AreEqual(0, edges.Count()); graph = new DirectedMetaGraph(1, 1, 10); // add and remove edges. graph.AddEdge(0, 1, 1, 100); graph.AddEdge(0, 2, 1, 100); Assert.AreEqual(2, graph.RemoveEdges(0)); // verify all edges. edges = graph.GetEdgeEnumerator(0); Assert.AreEqual(0, edges.Count()); edges = graph.GetEdgeEnumerator(1); Assert.AreEqual(0, edges.Count()); edges = graph.GetEdgeEnumerator(2); Assert.AreEqual(0, edges.Count()); graph = new DirectedMetaGraph(1, 1, 10); // add and remove edges. graph.AddEdge(0, 1, 1, 100); graph.AddEdge(0, 2, 2, 200); graph.AddEdge(1, 2, 3, 300); Assert.AreEqual(2, graph.RemoveEdges(0)); // verify all edges. edges = graph.GetEdgeEnumerator(0); Assert.AreEqual(0, edges.Count()); edges = graph.GetEdgeEnumerator(1); Assert.AreEqual(1, edges.Count()); edges = graph.GetEdgeEnumerator(2); Assert.AreEqual(0, edges.Count()); graph = new DirectedMetaGraph(1, 1, 10); // add and compress. graph.AddEdge(0, 1, 10, 100); graph.AddEdge(1, 2, 20, 200); graph.AddEdge(2, 3, 30, 300); graph.AddEdge(3, 4, 40, 400); Assert.AreEqual(1, graph.RemoveEdge(1, 2)); // verify all edges. edges = graph.GetEdgeEnumerator(0); Assert.AreEqual(1, edges.Count()); Assert.AreEqual(10, edges.First().Data[0]); Assert.AreEqual(100, edges.First().MetaData[0]); Assert.AreEqual(1, edges.First().Neighbour); edges = graph.GetEdgeEnumerator(1); Assert.AreEqual(0, edges.Count()); edges = graph.GetEdgeEnumerator(2); Assert.AreEqual(1, edges.Count()); Assert.AreEqual(30, edges.First().Data[0]); Assert.AreEqual(300, edges.First().MetaData[0]); Assert.AreEqual(3, edges.First().Neighbour); edges = graph.GetEdgeEnumerator(3); Assert.AreEqual(1, edges.Count()); Assert.AreEqual(40, edges.First().Data[0]); Assert.AreEqual(400, edges.First().MetaData[0]); Assert.AreEqual(4, edges.First().Neighbour); }