/// <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;
     }
 }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 4
0
 public void SetStart(Vertex start)
 {
     if (start == null) throw new ArgumentException();
     this._start = start;
 }
Ejemplo n.º 5
0
 public void SetEnd(Vertex end)
 {
     if (end == null) throw new ArgumentException();
     this._end = end;
 }
Ejemplo n.º 6
0
 public void Clear()
 {
     this._start = null;
     this._end = null;
 }
Ejemplo n.º 7
0
 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;
 }
Ejemplo n.º 8
0
 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);
 }
Ejemplo n.º 12
0
 public void TestGraphContains([PexAssumeUnderTest]Graph target, Vertex vertex)
 {
     target.Contains(vertex);
 }
Ejemplo n.º 13
0
 public void TestGraphAddVertex([PexAssumeUnderTest]Graph target, Vertex vertex)
 {
     target.AddVertex(vertex);
 }
Ejemplo n.º 14
0
 public void TestEdgeSetStart([PexAssumeUnderTest]Edge target, Vertex start)
 {
     target.SetStart(start);
 }
Ejemplo n.º 15
0
 /// <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;
 }