예제 #1
0
 public void RemoveEdge(EdgeDescriptor <V, E> edgeDesciptor)
 {
     if (EdgeItems != null)
     {
         EdgeItems.Remove(new Tuple <V, V>(edgeDesciptor.Vertex1, edgeDesciptor.Vertex2));
     }
 }
예제 #2
0
        public void AddEdge(EdgeDescriptor <V, E> edgeDesciptor)
        {
            if (EdgeItems == null)
            {
                EdgeItems = new SortedDictionary <Tuple <V, V>, EdgeDescriptor <V, E> >();
            }

            edgeDesciptor.GetInvertedVertex(Vertex); // Validate whether any of edge's vertices are equal to this vertex
            EdgeItems.Add(new Tuple <V, V>(edgeDesciptor.Vertex1, edgeDesciptor.Vertex2), edgeDesciptor);
        }
예제 #3
0
 public bool TryFindEdge(V vertex1, V vertex2, out EdgeDescriptor <V, E> edgeDesciptor)
 {
     if (EdgeItems != null)
     {
         return(EdgeItems.TryGetValue(new Tuple <V, V>(vertex1, vertex2), out edgeDesciptor));
     }
     else
     {
         edgeDesciptor = default(EdgeDescriptor <V, E>);
         return(false);
     }
 }