protected static void RemoveOutEdgeIf_Clusters_Test( [NotNull] ClusteredAdjacencyGraph <int, Edge <int> > graph) { Assert.AreEqual(0, graph.RemoveOutEdgeIf(1, edge => true)); AssertEmptyGraph(graph); var edge12 = new Edge <int>(1, 2); var edge13 = new Edge <int>(1, 3); var edge13Bis = new Edge <int>(1, 3); var edge14 = new Edge <int>(1, 4); var edge24 = new Edge <int>(2, 4); var edge31 = new Edge <int>(3, 1); var edge33 = new Edge <int>(3, 3); graph.AddVerticesAndEdgeRange(new[] { edge12, edge13, edge13Bis, edge14, edge24, edge31, edge33 }); Assert.AreEqual(3, graph.RemoveOutEdgeIf(1, edge => edge.Target >= 3)); AssertHasVertices(graph, new[] { 1, 2, 3, 4 }); AssertHasEdges(graph, new[] { edge12, edge24, edge31, edge33 }); Assert.AreEqual(0, graph.RemoveOutEdgeIf(3, edge => edge.Target > 5)); AssertHasVertices(graph, new[] { 1, 2, 3, 4 }); AssertHasEdges(graph, new[] { edge12, edge24, edge31, edge33 }); Assert.AreEqual(2, graph.RemoveOutEdgeIf(3, edge => true)); AssertHasVertices(graph, new[] { 1, 2, 3, 4 }); AssertHasEdges(graph, new[] { edge12, edge24 }); }