示例#1
0
        /// <summary>
        /// Returns a List containing the two Vertices at either end of Edge e
        /// </summary>
        /// <param name="e"></param>
        /// <returns></returns>
        public List <Vertex> EndVertices(Edge e)
        {
            if (e == null || e.GetVertexA() == null || e.GetVertexB() == null)
            {
                return(null);
            }

            List <Vertex> endPoints = new List <Vertex>();

            endPoints.Add(e.GetVertexA());
            endPoints.Add(e.GetVertexB());

            return(endPoints);
        }
示例#2
0
        /// <summary>
        /// Returns the destination of a directed Edge e
        /// </summary>
        /// <param name="e"></param>
        /// <returns></returns>
        public Vertex Destination(Edge e)
        {
            if (e == null)
            {
                return(null);
            }

            return(e.GetVertexB());
        }
示例#3
0
        /// <summary>
        /// Returns the opposite Vertex of Vertex v on Edge e
        /// </summary>
        /// <param name="v"></param>
        /// <param name="e"></param>
        /// <returns></returns>
        public Vertex Opposite(Vertex v, Edge e)
        {
            if (v == null || e == null)
            {
                return(null);
            }

            if (e.GetVertexA().GetId() == v.GetId())
            {
                return(GetVertex(e.GetVertexB().GetId()));
            }

            else if (e.GetVertexB().GetId() == v.GetId())
            {
                return(GetVertex(e.GetVertexA().GetId()));
            }

            return(null);
        }
示例#4
0
        /// <summary>
        /// Returns whether Edge e is Directed or not
        /// </summary>
        /// <param name="e"></param>
        /// <returns></returns>
        public bool IsDirected(Edge e)
        {
            if (e == null)
            {
                return(false);
            }

            string other = e.GetVertexA().GetConnections().Find(id => id == e.GetVertexB().GetId());

            Edge conj = e.Conjugate();

            return(other == conj.GetVertexB().GetId());
        }