Exemplo n.º 1
0
        static IEnumerable <GraphEdge> GetLayeredSuccessors(Node <ExpressionBuilder, ExpressionBuilderArgument> node, int layer, Dictionary <Node <ExpressionBuilder, ExpressionBuilderArgument>, GraphNode> layerMap)
        {
            foreach (var successor in node.Successors)
            {
                var layeredSuccessor = layerMap[successor.Target];
                var currentSuccessor = layeredSuccessor;

                var property = TypeDescriptor.CreateProperty(typeof(Edge <ExpressionBuilder, ExpressionBuilderArgument>), "Label", typeof(ExpressionBuilderArgument));
                var context  = new TypeDescriptorContext(successor, property);
                for (int i = layeredSuccessor.Layer + 1; i < layer; i++)
                {
                    var edge      = new GraphEdge(context, successor.Label, currentSuccessor);
                    var dummyNode = new GraphNode(null, i, Enumerable.Repeat(edge, 1));
                    dummyNode.Tag    = edge;
                    currentSuccessor = dummyNode;
                }

                yield return(new GraphEdge(context, successor.Label, currentSuccessor));
            }
        }
Exemplo n.º 2
0
 internal GraphEdge(GraphEdge edge, GraphNode successor)
 {
     Label = edge.Label;
     Node  = successor;
     Text  = edge.Text;
 }