Esempio n. 1
0
 private static IEnumerable <TVertex> IsolatedVerticesIterator <TVertex, TEdge>(
     IBidirectionalGraph <TVertex, TEdge> visitedGraph)
     where TEdge : IEdge <TVertex>
 {
     foreach (var v in visitedGraph.Vertices)
     {
         if (visitedGraph.Degree(v) == 0)
         {
             yield return(v);
         }
     }
 }
Esempio n. 2
0
        private static void AssertDegreeSumEqualsTwiceEdgeCount <TVertex, TEdge>(
            [NotNull] IBidirectionalGraph <TVertex, TEdge> graph)
            where TEdge : IEdge <TVertex>
        {
            int totalDegree = 0;

            foreach (TVertex vertex in graph.Vertices)
            {
                totalDegree += graph.Degree(vertex);
            }

            Assert.AreEqual(graph.EdgeCount * 2, totalDegree);
        }
Esempio n. 3
0
        public void DegreeSumEqualsTwiceEdgeCount(
            [PexAssumeNotNull] IBidirectionalGraph <string, Edge <string> > graph)
        {
            int edgeCount = graph.EdgeCount;
            int degCount  = 0;

            foreach (string v in graph.Vertices)
            {
                degCount += graph.Degree(v);
            }

            Assert.AreEqual(edgeCount * 2, degCount);
        }
Esempio n. 4
0
        public void DegreeSumEqualsTwiceEdgeCount <TVertex, TEdge>(
            [NotNull] IBidirectionalGraph <TVertex, TEdge> graph)
            where TEdge : IEdge <TVertex>
        {
            int edgeCount = graph.EdgeCount;
            int degCount  = 0;

            foreach (TVertex vertex in graph.Vertices)
            {
                degCount += graph.Degree(vertex);
            }

            Assert.AreEqual(edgeCount * 2, degCount);
        }
Esempio n. 5
0
        public static IEnumerable <TVertex> IsolatedVertices <TVertex, TEdge>(
            IBidirectionalGraph <TVertex, TEdge> visitedGraph)
            where TEdge : IEdge <TVertex>
        {
            GraphContracts.AssumeNotNull(visitedGraph, "visitedGraph");

            foreach (var v in visitedGraph.Vertices)
            {
                if (visitedGraph.Degree(v) == 0)
                {
                    yield return(v);
                }
            }
        }
        private void DegreeSumEqualsTwiceEdgeCount <TVertex, TEdge>(
            IBidirectionalGraph <TVertex, TEdge> graph)
            where TEdge : IEdge <TVertex>
        {
            int edgeCount = graph.EdgeCount;
            int degCount  = 0;

            foreach (var v in graph.Vertices)
            {
                degCount += graph.Degree(v);
            }

            Assert.Equal(edgeCount * 2, degCount);
        }