示例#1
0
 /// <summary>
 ///   Gets the edge specified by the two vertices.
 /// </summary>
 /// <param name="from"> The from vertex. </param>
 /// <param name="to"> The two vertex. </param>
 /// <returns> The edge between the two specified vertices if found. </returns>
 public Edge <T> GetEdge(Vertex <T> from, Vertex <T> to)
 {
     return(from.GetEmanatingEdgeTo(to));
 }
示例#2
0
        /// <summary>
        ///   Adds the edge to the graph.
        /// </summary>
        /// <param name="from"> The from vertex. </param>
        /// <param name="to"> The to vertex. </param>
        /// <param name="weight"> The weight of this edge. </param>
        public void AddEdge(Vertex <T> from, Vertex <T> to, double weight)
        {
            var edge = new Edge <T>(from, to, weight, graphIsDirected);

            AddEdge(edge);
        }
示例#3
0
 /// <summary>
 ///   Determines whether the specified vertex has a edge to the to vertex.
 /// </summary>
 /// <param name="vtx1"> The from vertex. </param>
 /// <param name="vtx2"> The to vertex. </param>
 /// <returns> <c>true</c> if the specified from vertex has an edge to the to vertex; otherwise, <c>false</c> . </returns>
 public bool ContainsEdge(Vertex <T> vtx1, Vertex <T> vtx2)
 {
     return(graphIsDirected ? vtx1.HasEmanatingEdgeTo(vtx2) : vtx1.HasIncidentEdgeWith(vtx2));
 }
示例#4
0
 /// <summary>
 ///   Determines whether this graph contains the specified vertex.
 /// </summary>
 /// <param name="vertex"> The vertex. </param>
 /// <returns> <c>true</c> if this instance contains the specified vertex; otherwise, <c>false</c> . </returns>
 public bool ContainsVertex(Vertex <T> vertex)
 {
     return(graphVertices.Contains(vertex));
 }