Ejemplo n.º 1
0
        bool IBidirectionalIncidenceGraph <TVertex, TEdge> .TryGetInEdges(TVertex v, out IEnumerable <TEdge> edges)
        {
            IBidirectionalIncidenceGraph <TVertex, TEdge> ithis = this;

            Contract.Requires(v != null);
            Contract.Requires(ithis.ContainsVertex(v));
            Contract.Ensures(Contract.Result <bool>() == ithis.ContainsVertex(v));
            Contract.Ensures(!Contract.Result <bool>() || Contract.ValueAtReturn(out edges) != null);
            Contract.Ensures(!Contract.Result <bool>() ||
                             Contract.ValueAtReturn(out edges).All(edge => edge != null && edge.Target.Equals(v)
                                                                   )
                             );

            edges = null;
            return(default(bool));
        }
        int IBidirectionalIncidenceGraph <TVertex, TEdge> .Degree(TVertex v)
        {
            IBidirectionalIncidenceGraph <TVertex, TEdge> ithis = this;

            Contract.Requires(v != null);
            Contract.Requires(ithis.ContainsVertex(v));
            Contract.Ensures(Contract.Result <int>() == ithis.InDegree(v) + ithis.OutDegree(v));

            return(default(int));
        }
        TEdge IBidirectionalIncidenceGraph <TVertex, TEdge> .InEdge(TVertex v, int index)
        {
            IBidirectionalIncidenceGraph <TVertex, TEdge> ithis = this;

            Contract.Requires(v != null);
            Contract.Requires(ithis.ContainsVertex(v));
            Contract.Ensures(Contract.Result <TEdge>().Equals(Enumerable.ElementAt(ithis.InEdges(v), index)));

            return(default(TEdge));
        }
        bool IBidirectionalIncidenceGraph <TVertex, TEdge> .IsInEdgesEmpty(TVertex v)
        {
            IBidirectionalIncidenceGraph <TVertex, TEdge> ithis = this;

            Contract.Requires(v != null);
            Contract.Requires(ithis.ContainsVertex(v));
            Contract.Ensures(Contract.Result <bool>() == (ithis.InDegree(v) == 0));

            return(default(bool));
        }
Ejemplo n.º 5
0
        IEnumerable <TEdge> IBidirectionalIncidenceGraph <TVertex, TEdge> .InEdges(TVertex v)
        {
            IBidirectionalIncidenceGraph <TVertex, TEdge> ithis = this;

            Contract.Requires(v != null);
            Contract.Requires(ithis.ContainsVertex(v));
            Contract.Ensures(Contract.Result <IEnumerable <TEdge> >() != null);
            Contract.Ensures(Contract.Result <IEnumerable <TEdge> >().All(edge => edge != null && edge.Target.Equals(v)
                                                                          )
                             );

            return(default(IEnumerable <TEdge>));
        }