/// <summary> /// Gets or sets the EdgeCollection associated with the given Vertex /// </summary> /// <param name="key"> /// The Vertex whose value to get or set. /// </param> public virtual EdgeCollection this[Vertex key] { get { return (EdgeCollection)this.Dictionary[key]; } set { this.Dictionary[key] = value; } }
public Edge AddEdge( Vertex source, Vertex target ) { // look for the vertex in the list if (!VertexOutEdges.ContainsKey(source)) throw new VertexNotFoundException("Could not find source vertex"); if (!VertexOutEdges.ContainsKey(target)) throw new VertexNotFoundException("Could not find target vertex"); // create edge Edge e = new Edge(); e.SetStart(source); e.SetEnd(target); VertexOutEdges[source].Add(e); m_Edges.Add(e); return e; }
static void Main(string[] args) { MyClass mc = new MyClass(); mc.NullCheckMethod(); mc.GetMySClass(); mc.DefineIJK(); mc.GetMySClass(); mc.NullCheckMethod(); mc.AccessI(); mc.AccessJ(); mc.AccessIK(); mc.AccessOtherClass(); /*MySubClass msc = new MySubClass(); msc.MySubI = 30; Console.WriteLine(msc.MySubI);*/ try { AdjacencyGraphOrig ag1 = new AdjacencyGraphOrig(); ag1.AddEdge(null, null); } catch (Exception ex) { } AdjacencyGraphOrig ag = new AdjacencyGraphOrig(); Vertex v1 = new Vertex(); ag.AddVertex(v1); Vertex v2 = new Vertex(); ag.AddVertex(v2); Edge edge = ag.AddEdge(v1, v2); TopologicalSort ts = new TopologicalSort(ag); ts.Compute(); //new SampleTests().test1(); //new DUCoverProgram().DUCoverTerminate(); }
public void SetStart(Vertex start) { if (start == null) throw new ArgumentException(); this._start = start; }
public void SetEnd(Vertex end) { if (end == null) throw new ArgumentException(); this._end = end; }
public void Clear() { this._start = null; this._end = null; }
public bool Contains(Vertex vertex) { if (vertex == null) throw new ArgumentException(); //if (verticesList.Contains(vertex)) return true; for (int i = 0; i < vertices.Length; i++) if (vertices[i] == vertex) return true; return false; }
public void AddVertex(Vertex vertex) { if (vertex == null) throw new ArgumentException(); //this.verticesList.Add(vertex); for (int i = 0; i < vertices.Length; i++) if (vertices[i] == null) { vertices[i] = vertex; return; } throw new ArgumentException("full"); }
/// <summary> /// Adds an element with the specified key and value to this VertexEdgesDictionary. /// </summary> /// <param name="key"> /// The Vertex key of the element to add. /// </param> /// <param name="value"> /// The EdgeCollection value of the element to add. /// </param> public virtual void Add(Vertex key, EdgeCollection value) { this.Dictionary.Add(key, value); }
/// <summary> /// Removes the element with the specified key from this VertexEdgesDictionary. /// </summary> /// <param name="key"> /// The Vertex key of the element to remove. /// </param> public virtual void Remove(Vertex key) { this.Dictionary.Remove(key); }
/// <summary> /// Determines whether this VertexEdgesDictionary contains a specific key. /// </summary> /// <param name="key"> /// The Vertex key to locate in this VertexEdgesDictionary. /// </param> /// <returns> /// true if this VertexEdgesDictionary contains an element with the specified key; /// otherwise, false. /// </returns> public virtual bool ContainsKey(Vertex key) { return this.Dictionary.Contains(key); }
public void TestGraphContains([PexAssumeUnderTest]Graph target, Vertex vertex) { target.Contains(vertex); }
public void TestGraphAddVertex([PexAssumeUnderTest]Graph target, Vertex vertex) { target.AddVertex(vertex); }
public void TestEdgeSetStart([PexAssumeUnderTest]Edge target, Vertex start) { target.SetStart(start); }
/// <summary>copyDir /// Add a new vertex to the graph and returns it. /// /// Complexity: 1 insertion. /// </summary> /// <returns>Create vertex</returns> public void AddVertex(Vertex v) { VertexOutEdges.Add(v, new EdgeCollection()); //return v; }