void dfs_DiscoverVertex(object sender, VertexEventArgs e)
        {
            TypeVertex v = (TypeVertex)e.Vertex;
            Trace.WriteLine("S: " + v.Name);
            Trace.Indent();
            PendingEdges.Push(new List<TypeVertex>());

            if (!destcg.ContainsVertex(v))
            {
                CondensedVertex nv;

                TypeReference tref = v.TypeRef;

                string trefNamespace = v.Namespace;

                if (!NamespaceVertexMap.ContainsKey(trefNamespace))
                {
                    nv = (CondensedVertex)destcg.AddVertex();
                    nv.NameSpaces[trefNamespace] = 0;
                    NamespaceVertexMap[trefNamespace] = new List<CondensedVertex>();
                    NamespaceVertexMap[trefNamespace].Add(nv);
                }
                else
                {
                    nv = NamespaceVertexMap[trefNamespace][0];
                }

                nv.NameSpaces[trefNamespace]++;
                nv.ContainedTypes.Add(tref);
                VertexReassignmentMap[v] = nv;
                return;

            }
        }
		public void StartVertex(Object sender, VertexEventArgs args)
		{
			Assert.IsTrue( sender is DepthFirstSearchAlgorithm );
			DepthFirstSearchAlgorithm algo = (DepthFirstSearchAlgorithm)sender;

			Assert.AreEqual(algo.Colors[args.Vertex], GraphColor.White);
		}
 public void FinishVertex(object sender, VertexEventArgs args)
 {
     if (this.VisitedGraph.OutEdgesEmpty(args.get_Vertex()))
     {
         this.sinks.Add(args.get_Vertex());
     }
 }
 void udfs_StartVertex(Object sender, VertexEventArgs e)
 {
     if (this.startVertex==null)
     {
         this.startVertex = (DataTableJoinVertex)e.Vertex;
         return;
     }
        throw new InvalidOperationException("The Join graph is not connected");
 }
        public void DiscoverVertex(Object sender, VertexEventArgs args)
        {
            Assert.IsTrue( sender is DepthFirstSearchAlgorithm );
            DepthFirstSearchAlgorithm algo = (DepthFirstSearchAlgorithm)sender;

            Assert.AreEqual(algo.Colors[args.Vertex], GraphColor.Gray);
            Assert.AreEqual(algo.Colors[Parents[args.Vertex]], GraphColor.Gray);

            DiscoverTimes[args.Vertex]=m_Time++;
        }
 public void FinishVertex(object sender, VertexEventArgs args)
 {
     IDictionaryEnumerator enumerator = this.Predecessors.GetEnumerator();
     while (enumerator.MoveNext())
     {
         DictionaryEntry current = (DictionaryEntry) enumerator.Current;
         IEdge edge = (IEdge) current.Value;
         if (edge.get_Source() == args.get_Vertex())
         {
             return;
         }
     }
     this.EndPathVertices.Add(args.get_Vertex());
 }
        void dfs_DiscoverVertex(object sender, VertexEventArgs e)
        {
            CondensedVertex v = (CondensedVertex)e.Vertex;
            Trace.WriteLine("S: " + v.Name);
            Trace.Indent();
            PendingEdges.Push(new List<CondensedVertex>());

            Debug.Assert(!destcg.ContainsVertex(v));

            CondensedVertex nv;

            if (v.NameSpaces.Count > 1) // scc with mult NS
            {
                destcg.AddVertex(v);
                VertexReassignmentMap[v] = v;
                return;
            }
            string trefNamespace = TypeVertex.GetNamespace(v);

            if (!NamespaceVertexMap.ContainsKey(trefNamespace))
            {
                nv = (CondensedVertex)destcg.AddVertex();
                nv.NameSpaces[trefNamespace] = 0;
                NamespaceVertexMap[trefNamespace] = new List<CondensedVertex>();
                NamespaceVertexMap[trefNamespace].Add(nv);
            }
            else
            {
                nv = NamespaceVertexMap[trefNamespace][0];
            }

            nv.NameSpaces[trefNamespace]++;
            foreach (TypeReference tref in v.ContainedTypes)
            {
                nv.ContainedTypes.Add(tref);
            }
            VertexReassignmentMap[v] = nv;
            return;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        public void WriteVertex(Object sender, VertexEventArgs args)
        {
            if (m_Colors!=null &&  m_Colors.Contains(args.Vertex))
            {
                GraphColor c = (GraphColor)m_Colors[args.Vertex];
                VertexFormatter.FillColor = GraphColorConverter.Convert(c);
                if (c == GraphColor.Black)
                    VertexFormatter.FontColor = Color.White;
                else
                    VertexFormatter.FontColor = Color.Black;
            }
            else
                VertexFormatter.StrokeColor = Color.White;

            if (m_VertexLabels != null)
                VertexFormatter.Label = m_VertexLabels[args.Vertex].ToString();

            ((GraphvizAlgorithm)sender).Output.Write(VertexFormatter.ToDot());
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 public void FinishVertex(Object sender, VertexEventArgs args)
 {
     OutputGraph(sender,args);
 }
 private void FinishVertex(object sender, VertexEventArgs args)
 {
     IVertex vertex = args.get_Vertex();
     IEdgeEnumerator enumerator = this.VisitedGraph.OutEdges(vertex).GetEnumerator();
     while (enumerator.MoveNext())
     {
         IVertex vertex2 = enumerator.get_Current().get_Target();
         if (this.Components.get_Item(vertex2) == 0x7fffffff)
         {
             this.Roots.set_Item(vertex, this.MinDiscoverTime(this.Roots.get_Item(vertex), this.Roots.get_Item(vertex2)));
         }
     }
     if (this.Roots.get_Item(vertex) == vertex)
     {
         IVertex vertex3 = null;
         do
         {
             vertex3 = (IVertex) this.stack.Peek();
             this.stack.Pop();
             this.Components.set_Item(vertex3, this.count);
         }
         while (vertex3 != vertex);
         this.count++;
     }
 }
 private void StartVertex(object sender, VertexEventArgs args)
 {
     this.count++;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 public void InitializeVertex(Object sender, VertexEventArgs args)
 {
     //UpdatePanel();
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 public void DiscoverVertex(Object sender, VertexEventArgs args)
 {
     UpdatePanel();
 }
 public void FinishVertex(object sender, VertexEventArgs args)
 {
     this.m_FinishTimes.set_Item(args.get_Vertex(), this.m_Time++);
 }
 public void DiscoverVertex(object sender, VertexEventArgs args)
 {
     this.m_DiscoverTimes.set_Item(args.get_Vertex(), this.m_Time++);
 }
示例#16
0
 /// <summary>
 /// d[u] = 0;
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 public void DiscoverVertex(Object sender, VertexEventArgs args)
 {
     m_Distances[args.Vertex]=0;
 }
        public void FinishVertex(Object sender, VertexEventArgs args)
        {
            Assert.IsTrue(sender is UndirectedDepthFirstSearchAlgorithm);
            UndirectedDepthFirstSearchAlgorithm algo = (UndirectedDepthFirstSearchAlgorithm)sender;

            Assert.AreEqual(algo.Colors[args.Vertex], GraphColor.Black);
            FinishTimes[args.Vertex] = time++;
        }
示例#18
0
        public void WriteVertex(Object sender, VertexEventArgs args)
        {
            // setting the vertex name
            Vertex.Label = Names[args.Vertex];

            // outputting to dot
            // sender is the graphviz writer algorithm
            ((GraphvizAlgorithm)sender).Output.Write(Vertex.ToDot());
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 public void FinishVertex(Object sender, VertexEventArgs args)
 {
     UpdatePanel();
 }
 /// <summary>
 /// Delegate that adds the vertex to the vertex list. <seealso cref="VertexEventHandler"/>.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 public void FinishVertex(Object sender, VertexEventArgs args)
 {
     m_Vertices.Insert(0,args.Vertex);
 }
 private void DiscoverVertex(object sender, VertexEventArgs args)
 {
     this.Components.set_Item(args.get_Vertex(), this.count);
 }
		/// <summary>
		/// Visits vertex s
		/// </summary>
		/// <param name="u">vertex to visit</param>
		public void Visit(IVertex u)
		{
			VertexEventArgs uArgs = new VertexEventArgs(u);

			Colors[u]=GraphColor.Gray;
			OnDiscoverVertex(u);

            IEdgeEnumerable outEdges = VisitedGraph.OutEdges(u);
            VisitEdges(outEdges,true);
            IEdgeEnumerable intEdges = VisitedGraph.InEdges(u);
            VisitEdges(intEdges,false);

            Colors[u]=GraphColor.Black;
			OnFinishVertex(u);
		}
 private void DiscoverVertex(object sender, VertexEventArgs args)
 {
     IVertex vertex = args.get_Vertex();
     this.Roots.set_Item(vertex, vertex);
     this.Components.set_Item(vertex, 0x7fffffff);
     this.DiscoverTimes.set_Item(vertex, this.dfsTime++);
     this.stack.Push(vertex);
 }
 void algo_DeficientVertexAdded(Object sender, VertexEventArgs e)
 {
     Console.WriteLine("Deficient vertex: {0}", ((NamedVertex)e.Vertex).Name);
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 public void DiscoverVertex(Object sender, VertexEventArgs args)
 {
     OutputGraph(sender,args);
 }
 void algo_SurplusVertexAdded(Object sender, VertexEventArgs e)
 {
     Console.WriteLine("Surplus vertex: {0}", ((NamedVertex)e.Vertex).Name);
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 public void InitializeVertex(Object sender, VertexEventArgs args)
 {
 }
 public void StartVertex(Object sender, VertexEventArgs e)
 {
     this.graph.AddVertex(e.Vertex);
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        protected void OutputGraph(Object sender, VertexEventArgs args)
        {
            IVertexColorizerAlgorithm algo = (IVertexColorizerAlgorithm)sender;
            m_Colors = algo.Colors;

            UpdateFileName();
            m_Algo.Write(CurrentFileName);
        }
示例#30
0
 /// <summary>
 /// d[u] = + intfy
 /// </summary>
 /// <param name="sender">Algorithm using the visitor</param>
 /// <param name="args">Contains the vertex</param>
 public void InitializeVertex(Object sender, VertexEventArgs args)
 {
     m_Distances[args.Vertex] = int.MaxValue;
 }