Пример #1
0
 /// <summary>
 /// Returns the string representation of this SGLEdge.
 /// </summary>
 /// <returns></returns>
 public override string ToString()
 {
     if (Directed == false)
     {
         return(StartingSGLNode.ToString() + " <---> " + (EndingSGLNode == null ? "null" : EndingSGLNode.ToString()));
     }
     else
     {
         return(StartingSGLNode.ToString() + " ---> " + (EndingSGLNode == null ? "null" : EndingSGLNode.ToString()));
     }
 }
Пример #2
0
        private string StringForm(string data)
        {
            SGLNode <T> current = Reverse(Top);
            SGLNode <T> topHold = current;

            while (current != null)
            {
                data    = data + current.ToString() + (current.GetNext() == null ? "" : ", ");
                current = current.GetNext();
            }
            Top = Reverse(topHold);
            return(data);
        }
Пример #3
0
 /// <summary>
 /// Deletes a SGLNode by removing all references from the colection
 /// of vertices of the graph and its Nodes.
 /// </summary>
 /// <param name="SGLNode"></param>
 /// <returns></returns>
 public bool DeleteVertex(SGLNode <T> SGLNode)
 {
     Console.WriteLine(SGLNode.ToString() + " is the SGLNode");
     for (int i = 0; i < Vertices.Length(); i++)
     {
         for (int j = 0; j < Vertices.Get(i).GetAdjacencyList().Length(); j++)
         {
             if (Object.ReferenceEquals(Vertices.Get(i).GetAdjacencyList().Get(j), SGLNode))
             {
                 Vertices.Get(i).DeleteNode(SGLNode);
                 return(true);
             }
         }
     }
     return(false);
 }