// TODO trim method on raw size. /// <summary> /// Method that return a soft copy of given SGLArrayList /// Where the new list will share the references of old values with /// given lists copys. /// </summary> /// <returns></returns> public SGLArrayList <T> SoftCopy() { SGLArrayList <T> newCopy = new SGLArrayList <T>(); for (int index = 0; index < this.Length(); index++) { newCopy.Add(this.Get(index)); } return(newCopy); }
private string StringForm(string data) { SGLArrayList <SGLNode <T> > SGLNodes = new SGLArrayList <SGLNode <T> >(); SGLNode <T> temp = Front; int index = 0; while (temp != null) { SGLNodes.Add(temp); temp = temp.GetNext(); data = data + SGLNodes.Get(index).ToString() + (temp == null ? "" : ", "); index++; } Front = SGLNodes.Get(0); return(data); }
/// <summary> /// Adds an SGLNode to the list of associated SGLNodes. /// </summary> /// <param name="SGLNode"></param> public void AddNode(SGLNode <T> SGLNode) { SGLEdge <T> edge = new SGLEdge <T>(this, SGLNode); AdjacencyList.Add(edge); }
/// <summary> /// Adds a vertex to the list of vertices associated with this graph. /// </summary> /// <param name="data"></param> public void AddVertex(T data) { Vertices.Add(new SGLNode <T>(data)); }
public SGLGraph(SGLNode <T> SGLNode, bool directed) { Directed = directed; Vertices = new SGLArrayList <SGLNode <T> >(); Vertices.Add(SGLNode); }
public SGLGraph(SGLNode <T> SGLNode) { Directed = false; Vertices = new SGLArrayList <SGLNode <T> >(); Vertices.Add(SGLNode); }