/// <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); }
/// <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()); }
/// <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); }
/// <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()); }