Beispiel #1
0
        public void ContainsVertex_Throws()
        {
            var filteredGraph = new FilteredImplicitVertexSet <TestVertex, Edge <TestVertex>, AdjacencyGraph <TestVertex, Edge <TestVertex> > >(
                new AdjacencyGraph <TestVertex, Edge <TestVertex> >(),
                _ => true,
                _ => true);

            ContainsVertex_Throws_Test(filteredGraph);
        }
Beispiel #2
0
        public void Construction()
        {
            VertexPredicate <int>            vertexPredicate = _ => true;
            EdgePredicate <int, Edge <int> > edgePredicate   = _ => true;

            var graph1         = new AdjacencyGraph <int, Edge <int> >();
            var filteredGraph1 = new FilteredImplicitVertexSet <int, Edge <int>, AdjacencyGraph <int, Edge <int> > >(
                graph1,
                vertexPredicate,
                edgePredicate);

            AssertGraphProperties(filteredGraph1, graph1);

            graph1         = new AdjacencyGraph <int, Edge <int> >(false);
            filteredGraph1 = new FilteredImplicitVertexSet <int, Edge <int>, AdjacencyGraph <int, Edge <int> > >(
                graph1,
                vertexPredicate,
                edgePredicate);
            AssertGraphProperties(filteredGraph1, graph1, parallelEdges: false);

            var graph2         = new UndirectedGraph <int, Edge <int> >();
            var filteredGraph2 = new FilteredImplicitVertexSet <int, Edge <int>, UndirectedGraph <int, Edge <int> > >(
                graph2,
                vertexPredicate,
                edgePredicate);

            AssertGraphProperties(filteredGraph2, graph2, false);

            graph2         = new UndirectedGraph <int, Edge <int> >(false);
            filteredGraph2 = new FilteredImplicitVertexSet <int, Edge <int>, UndirectedGraph <int, Edge <int> > >(
                graph2,
                vertexPredicate,
                edgePredicate);
            AssertGraphProperties(filteredGraph2, graph2, false, false);

            #region Local function

            void AssertGraphProperties <TVertex, TEdge, TGraph>(
                FilteredImplicitVertexSet <TVertex, TEdge, TGraph> g,
                TGraph expectedGraph,
                bool isDirected    = true,
                bool parallelEdges = true)
                where TEdge : IEdge <TVertex>
                where TGraph : IGraph <TVertex, TEdge>, IImplicitVertexSet <TVertex>
            {
                Assert.AreSame(expectedGraph, g.BaseGraph);
                Assert.AreEqual(isDirected, g.IsDirected);
                Assert.AreEqual(parallelEdges, g.AllowParallelEdges);
                Assert.AreSame(vertexPredicate, g.VertexPredicate);
                Assert.AreSame(edgePredicate, g.EdgePredicate);
            }

            #endregion
        }