コード例 #1
0
ファイル: SGLGraph.cs プロジェクト: JuanRiosJustus/SGL
        /// <summary>
        /// Deletes a vertex in the list of avaialable vertices associated with the graph.
        /// </summary>
        /// <param name="index"></param>
        public void DeleteVertex(int index)
        {
            SGLNode <T> toDelete = Vertices.Get(index);

            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), toDelete))
                    {
                        Vertices.Get(i).GetAdjacencyList().Delete(j);
                    }
                }
            }
        }
コード例 #2
0
ファイル: SGLNode.cs プロジェクト: JuanRiosJustus/SGL
 /// <summary>
 /// Deletes an SGLNode with the reference to the given SGLNode.
 /// Returns true if and only if a SGLNode of the same reference is deleted.
 /// </summary>
 /// <param name="index"></param>
 public bool DeleteNode(SGLNode <T> SGLNode)
 {
     for (int i = 0; i < AdjacencyList.Length(); i++)
     {
         if (Object.ReferenceEquals(AdjacencyList.Get(i), SGLNode))
         {
             AdjacencyList.Delete(i);
             return(true);
         }
     }
     return(false);
 }