public void EdgeCondensationAllVertices([NotNull] IBidirectionalGraph <int, Edge <int> > graph)
        {
            IMutableBidirectionalGraph <int, MergedEdge <int, Edge <int> > > condensedGraph =
                graph.CondensateEdges(v => true);

            Assert.IsNotNull(condensedGraph);
            Assert.AreEqual(graph.VertexCount, condensedGraph.VertexCount);
            Assert.AreEqual(graph.EdgeCount, condensedGraph.EdgeCount);
            CollectionAssert.AreEquivalent(graph.Vertices, condensedGraph.Vertices);
            CollectionAssert.AreEquivalent(graph.Edges, condensedGraph.Edges.SelectMany(e => e.Edges));
        }
        private static void RunEdgesCondensationAndCheck <TVertex, TEdge>(
            [NotNull] IBidirectionalGraph <TVertex, TEdge> graph,
            [NotNull] VertexPredicate <TVertex> predicate)
            where TEdge : IEdge <TVertex>
        {
            IMutableBidirectionalGraph <TVertex, MergedEdge <TVertex, TEdge> > condensedGraph =
                graph.CondensateEdges(predicate);

            Assert.IsNotNull(condensedGraph);
            Assert.LessOrEqual(condensedGraph.VertexCount, graph.VertexCount);

            TVertex[] vertices = condensedGraph.Vertices.ToArray();
            foreach (MergedEdge <TVertex, TEdge> edge in condensedGraph.Edges)
            {
                Assert.Contains(edge.Source, vertices);
                Assert.Contains(edge.Target, vertices);

                Assert.Positive(edge.Edges.Count);
                Assert.Contains(edge.Edges.First().Source, vertices);
                Assert.Contains(edge.Edges.Last().Target, vertices);
            }
        }