Ejemplo n.º 1
0
        /// <summary>
        /// Returns true and adds the edge iff the specified directed edge does not lead to a cycle.
        /// </summary>
        public bool AddEdge(Node.Output source, Node.Input sink)
        {
            IEnumerable <Node> nodeList = DepthFirstSearch(source.Node);

            // if sink can be reached after starting dfs at the source the new edge would create a cycle
            if (nodeList.Any(node => node.Inputs.Contains(sink)))
            {
                return(false);
            }
            else
            {
                sink.Source = source;
                return(true);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Gets the frame rendered for the given output or null if the output hasn't been rendered.
 /// </summary>
 public Frame this[Node.Output output]
 {
     get { return(dic.ContainsKey(output) ? dic[output] : null); }
 }