public void Output(string name) { var output = new Expr(name, ExprType.Output); _graph.AddVertex(output); _graph.AddEdge(new Edge <Expr>(this, output)); }
public Expr(string name, ExprType type) { Name = name; Type = type; _graph = new Graph(); _graph.AddVertex(this); }
private Graph ConcatGraphs(params Graph[] graphs) { var result = new Graph(); for (int i = 0; i < graphs.Length; i++) { result.AddVertexRange(graphs[i].Vertices); result.AddEdgeRange(graphs[i].Edges); } result.AddVertex(this); foreach (var sink in graphs.SelectMany(x => x.Sinks())) { result.AddEdge(new Edge <Expr>(sink, this)); } return(result); }