public void ExamineEdge(Object sender, EdgeEventArgs args)
        {
            Assert.IsTrue( sender is DepthFirstSearchAlgorithm );
            DepthFirstSearchAlgorithm algo = (DepthFirstSearchAlgorithm)sender;

            Assert.AreEqual(algo.Colors[args.Edge.Source], GraphColor.Gray);
        }
 /// <summary>
 /// Let e = (u,v), p[u]=e
 /// </summary>
 public void TreeEdge(Object sender, EdgeEventArgs args)
 {
     if (args.Edge is ReversedEdge)
         this.Successors[args.Edge.Source]=((ReversedEdge)args.Edge).Wrapped;
     else
         this.Successors[args.Edge.Source]=args.Edge;
 }
 public static void InitEdge(object sender, EdgeEventArgs arg)
 {
     string s = (arg.Edge.Source is MyVertex)? ((MyVertex)arg.Edge.Source).Name :
         arg.Edge.Source.ID.ToString();
     string t = (arg.Edge.Target is MyVertex)? ((MyVertex)arg.Edge.Target).Name :
         arg.Edge.Target.ID.ToString();
     Console.WriteLine("Edge from {0} to {1}",s,t);
 }
 public void TreeEdge(object sender, EdgeEventArgs args)
 {
     if (args.get_Edge() is ReversedEdge)
     {
         this.Successors.set_Item(args.get_Edge().get_Source(), ((ReversedEdge) args.get_Edge()).get_Wrapped());
     }
     else
     {
         this.Successors.set_Item(args.get_Edge().get_Source(), args.get_Edge());
     }
 }
        private void dfs_TreeEdge(object sender, EdgeEventArgs e)
        {
            if (this.edgeColors==null || !this.edgeColors.Contains(e.Edge))
                return;

            this.edgeColors[e.Edge]= GraphColor.Gray;
        }
		/// <summary>
		/// Records end path edges
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="args"></param>
		public void FinishEdge(Object sender, EdgeEventArgs args)
		{
			if (!EdgePredecessors.ContainsValue(args.Edge))
				EndPathEdges.Add(args.Edge);
		}
 /// <summary>
 /// Extracts the color tables from the calling algorithm
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 protected void GetColors(Object sender, EdgeEventArgs args)
 {
     if (sender is IVertexColorizerAlgorithm)
     {
         IVertexColorizerAlgorithm algo = (IVertexColorizerAlgorithm)sender;
         m_Colors = algo.Colors;
     }
     if (sender is IEdgeColorizerAlgorithm)
     {
         IEdgeColorizerAlgorithm algo = (IEdgeColorizerAlgorithm)sender;
         m_EdgeColors = algo.EdgeColors;
     }
     else if (m_EdgeColors != null)
         m_EdgeColors[args.Edge]=GraphColor.Black;
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        public void TreeEdge(Object sender, EdgeEventArgs args)
        {
            GetColors(sender,args);

            UpdateFileName();
            m_Algo.Write(CurrentFileName);
        }
Exemple #9
0
		/// <summary>
		/// Used in OutEdgeTree
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		internal static void dfs_BackEdge(object sender, EdgeEventArgs e)
		{
			throw new NonAcyclicGraphException();	
		}
 public void InitializeEdge(Object sender, EdgeEventArgs args)
 {
     UpdatePanel();
 }
        public void TreeEdge(Object sender, EdgeEventArgs args)
        {
            // get the state of the previous vertex (IL)
            this.getNullState(args.Edge);
            //	log.WriteLine("TreeEdge: {0}:{1}->{2}, {3}",args.Edge.ID,args.Edge.Source,args.Edge.Target,this.nullState);
            this.source = (InstructionVertex)args.Edge.Source;
            this.target = (InstructionVertex)args.Edge.Target;

            // propagate state
            foreach(IEdge e in this.graph.OutEdges((InstructionVertex)args.Edge.Target))
            {
                this.edgeNullStates[e]=this.nullState;
                this.vertexNullStates[e.Target]=this.nullState;
            }

            //this.displayInstruction();
            // check state
            if (this.nullState!=NullState.NonNull)
            {
                this.checkMethodInvoke();
            }

            // update next state
            this.updateBrTrueFalse();
        }
 public void InitializeEdge(object sender, EdgeEventArgs args)
 {
     // put vertex to uncertain
     if (!this.edgeNullStates.Contains(args.Edge))
     {
         this.edgeNullStates.Add(args.Edge, NullState.Uncertain);
         this.vertexNullStates[args.Edge.Source]=NullState.Uncertain;
         this.vertexNullStates[args.Edge.Target]=NullState.Uncertain;
     }
 }
 /// <summary>
 /// Delegate event that detects cycle. <seealso cref="EdgeEventHandler"/>.
 /// </summary>
 /// <param name="sender">DepthFirstSearch algorithm</param>
 /// <param name="args">Edge that produced the error</param>
 /// <exception cref="Exception">Will always throw an exception.</exception>
 public void BackEdge(Object sender, EdgeEventArgs args)
 {
     throw new NonAcyclicGraphException();
 }
 /// <summary>
 /// Checks for edge relation.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 public void TreeEdge(Object sender, EdgeEventArgs args)
 {
     bool decreased = Relax(args.Edge);
     if (decreased)
     {
         if (EdgeRelaxed != null)
             EdgeRelaxed(this, new EdgeEventArgs(args.Edge));
     }
     else
     {
         if (EdgeNotRelaxed != null)
             EdgeNotRelaxed(this, new EdgeEventArgs(args.Edge));
     }
 }
 /// <summary>
 /// Checks for edge relation.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 public void GrayTarget(Object sender, EdgeEventArgs args)
 {
     bool decreased = Relax(args.Edge);
     if (decreased)
     {
         m_VertexQueue.Update(args.Edge.Target);
         if (EdgeRelaxed != null)
             EdgeRelaxed(this, new EdgeEventArgs(args.Edge));
     }
     else
     {
         if (EdgeNotRelaxed != null)
             EdgeNotRelaxed(this, new EdgeEventArgs(args.Edge));
     }
 }
        public void BackEdge(Object sender, EdgeEventArgs args)
        {
            Assert.IsTrue(sender is UndirectedDepthFirstSearchAlgorithm);
            UndirectedDepthFirstSearchAlgorithm algo = (UndirectedDepthFirstSearchAlgorithm)sender;

            bool sourceGray = algo.Colors[args.Edge.Source]== GraphColor.Gray;
            bool targetGray = algo.Colors[args.Edge.Target] == GraphColor.Gray;
            Assert.IsTrue(sourceGray || targetGray);
        }
 public void FinishEdge(Object sender, EdgeEventArgs args)
 {
     UpdatePanel();
 }
 public void FinishEdge(Object sender, EdgeEventArgs args)
 {
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 public void TreeEdge(Object sender, EdgeEventArgs args)
 {
     UpdatePanel();
 }
 public void BackForwardOrCrossEdge(Object sender, EdgeEventArgs e)
 {
     this.graph.AddEdge(e.Edge);
 }
 protected virtual void OnReservedEdgeAdded(EdgeEventArgs e)
 {
     if (this.ReversedEdgeAdded != null)
         this.ReversedEdgeAdded(this, e);
 }
 public void TreeEdge(Object sender, EdgeEventArgs e)
 {
     this.graph.AddVertex(e.Edge.Target);
     this.graph.AddEdge(e.Edge);
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        public void WriteEdge(Object sender, EdgeEventArgs args)
        {
            if (m_EdgeColors != null && m_EdgeColors.Contains(args.Edge))
            {
                GraphColor c = (GraphColor)m_EdgeColors[args.Edge];
                switch(c)
                {
                    case GraphColor.White:
                        EdgeFormatter.Style = GraphvizEdgeStyle.Unspecified;
                        EdgeFormatter.StrokeColor = Color.Black;
                        break;
                    case GraphColor.Gray:
                        EdgeFormatter.Style = GraphvizEdgeStyle.Bold;
                        EdgeFormatter.StrokeColor = Color.Gray;
                        break;
                    case GraphColor.Black:
                        EdgeFormatter.Style = GraphvizEdgeStyle.Bold;
                        EdgeFormatter.StrokeColor = Color.Black;
                        break;
                }
            }
            else
                EdgeFormatter.Style = GraphvizEdgeStyle.Unspecified;

            if (EdgeLabels != null)
                EdgeFormatter.Label.Value = EdgeLabels[args.Edge].ToString();

            ((GraphvizAlgorithm)sender).Output.Write(EdgeFormatter.ToDot());
        }
 /// <summary>
 /// Event handler that applies the factor the edge weight
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e">event arguement containing the edge</param>
 public void TreeEdge(Object sender, EdgeEventArgs e)
 {
     this.weights[e.Edge]=this.weights[e.Edge]*factor;
 }
		/// <summary>
		/// Not used
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="args"></param>
		public void InitializeEdge(Object sender, EdgeEventArgs args)
		{
		}
 private void reverser_ReversedEdgeAdded(object sender, EdgeEventArgs e)
 {
     this.capacities.set_Item(e.get_Edge(), 0.0);
 }
        private void dfs_ForwardOrCrossEdge(object sender, EdgeEventArgs e)
        {
            if (this.edgeColors==null || !this.edgeColors.Contains(e.Edge))
                return;

            this.edgeColors[e.Edge] = GraphColor.Black;
        }
 /// <summary>
 /// Let e = (u,v), d[ v ] = d[ u ] + 1; 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 public void TreeEdge(Object sender, EdgeEventArgs args)
 {
     m_Distances[args.Edge.Target] = m_Distances[args.Edge.Source] + 1;
 }
        private void walker_WeightedTreeEdge(object sender, EdgeEventArgs e)
        {
            this.vertexCounts[e.Edge.Target]++;
            this.edgeCounts[e.Edge]++;
            this.edgeWeights[e.Edge]*=0.9;

            PropertyGridShape shape =
                (PropertyGridShape)this.netronPanel.Populator.VertexShapes[e.Edge.Source];
            shape.TitleBackColor = Color.White;

            shape =
                (PropertyGridShape)this.netronPanel.Populator.VertexShapes[e.Edge.Target];
            shape.TitleBackColor = Color.LightGreen;
            shape.Title = this.vertexCounts[e.Edge.Target].ToString();
            this.netronPanel.Invalidate();
        }
        public void TreeEdge(Object sender, EdgeEventArgs args)
        {
            Assert.IsTrue(sender is UndirectedDepthFirstSearchAlgorithm);
            UndirectedDepthFirstSearchAlgorithm algo = (UndirectedDepthFirstSearchAlgorithm)sender;

            bool sourceWhite = algo.Colors[args.Edge.Source]== GraphColor.White;
            bool targetWhite = algo.Colors[args.Edge.Target] == GraphColor.White;

            Assert.IsTrue(sourceWhite || targetWhite);
            if (targetWhite)
                Parents[args.Edge.Target] = args.Edge.Source;
            else
                Parents[args.Edge.Source] = args.Edge.Target;
        }