Exemplo n.º 1
0
 public void InheritSourceConflicts(NodeIndex newNode, NodeIndex oldNode)
 {
     foreach (EdgeIndex edge in graph.EdgesInto(oldNode).ToArray())
     {
         int       source = graph.SourceOf(edge);
         EdgeIndex edge2  = graph.AddEdge(source, newNode);
         prohibitedLoopVars[edge2] = prohibitedLoopVars[edge];
         offsetInfos[edge2]        = offsetInfos[edge];
     }
 }
Exemplo n.º 2
0
        protected void AddEdges(Graph g, NodeIndex index)
        {
            Node nd = nodeOf[index];

            if (nd == null)
            {
                return;
            }
            foreach (EdgeIndex edge in dg.EdgesInto(index))
            {
                NodeIndex sourceIndex = dg.SourceOf(edge);
                Node      nd2         = nodeOf[sourceIndex];
                if (nd2 == null)
                {
                    continue;
                }
                EdgeStyle style = GetEdgeStyle(edge);
                Edge      e;
                if ((style & EdgeStyle.Back) > 0)
                {
                    e                        = g.AddEdge(nd.Attr.Id, nd2.Attr.Id);
                    e.Attr.Color             = Color.Red;
                    e.Attr.ArrowheadAtSource = ArrowStyle.Normal;
                    e.Attr.ArrowheadAtTarget = ArrowStyle.None;
                    if ((style & EdgeStyle.Blue) > 0)
                    {
                        e.Attr.Color = Color.Purple;
                    }
                }
                else
                {
                    e = g.AddEdge(nd2.Attr.Id, nd.Attr.Id);
                    if ((style & EdgeStyle.Blue) > 0)
                    {
                        e.Attr.Color = Color.Blue;
                    }
                    if ((style & EdgeStyle.Dimmed) > 0)
                    {
                        e.Attr.Color = Color.LightGray;
                    }
                }
                if (edgeName != null)
                {
                    e.LabelText = edgeName(edge);
                }
                if ((style & EdgeStyle.Bold) > 0)
                {
                    e.Attr.LineWidth = 2;
                }
                if ((style & EdgeStyle.Dashed) > 0)
                {
                    e.Attr.AddStyle(Style.Dashed);
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Returns all nodes in the schedule whose target appears prior to the node.
        /// </summary>
        /// <param name="g"></param>
        /// <param name="schedule"></param>
        /// <param name="isDeleted"></param>
        /// <returns></returns>
        internal static Set <NodeIndex> CollectUses(IndexedGraph g, IEnumerable <NodeIndex> schedule, Func <EdgeIndex, bool> isDeleted = null)
        {
            Set <NodeIndex> uses      = new Set <NodeIndex>();
            Set <NodeIndex> available = new Set <NodeIndex>();

            foreach (NodeIndex node in schedule)
            {
                foreach (EdgeIndex edge in g.EdgesInto(node).Where(e => isDeleted == null || !isDeleted(e)))
                {
                    NodeIndex source = g.SourceOf(edge);
                    if (!available.Contains(source))
                    {
                        uses.Add(source);
                    }
                }
                available.Add(node);
            }
            return(uses);
        }