public void AddEdgeType <TFrom, TTo, TSource>( Expression <Func <TSource, dynamic> > fromKey, Expression <Func <TSource, dynamic> > toKey, Func <TSource, bool> predicate = null, params Expression <Func <TSource, dynamic> >[] properties) where TFrom : class where TTo : class { var edgeType = new EdgeType <TFrom, TTo, TSource>(fromKey, toKey, predicate, properties); if (EdgeTypes.Any(e => e.Label == edgeType.Label)) { throw new Exception($"EdgeType already added: {edgeType.Label}"); } EdgeTypes.Add(edgeType); }
public void ClassificateEdges(ControlFlowGraph cfg) { DSTree = new DepthSpanningTree(cfg); foreach (var edge in cfg.Edges) { if (DSTree.Edges.Any(e => e.Target.Equals(edge.Target) && e.Source.Equals(edge.Source))) { EdgeTypes.Add(edge, EdgeType.Coming); } else if (FindBackwardPath(edge.Source, edge.Target)) { EdgeTypes.Add(edge, EdgeType.Retreating); } else { EdgeTypes.Add(edge, EdgeType.Cross); } } }