public static IEnumerable <T> Traverse <T>(this IGraph <T> graph, Func <ISelectTraverseStrategy <T>, IBuildTraverseStrategy <T> > traversalOptions, T startingVertex) { if (traversalOptions == null) { throw new ArgumentNullException(nameof(traversalOptions)); } var builder = new TraverseStrategyBuilder <T>(graph, startingVertex); return(traversalOptions(builder).Build()); }
public static IEnumerable <TValue> Traverse <TKey, TValue, TNode>(this ITree <TKey, TValue, TNode> tree, Func <ISelectTraverseStrategy <TValue>, IBuildTraverseStrategy <TValue> > traversalOptions) where TNode : INode <TKey, TValue, TNode> { if (traversalOptions == null) { throw new ArgumentNullException(nameof(traversalOptions)); } var builder = new TraverseStrategyBuilder <TKey, TValue, TNode>(tree); return(traversalOptions(builder).Build()); }