Shields.Graphs/Graph.cs
/// <summary>
/// Performs a breadth-first traversal of a graph or digraph.
/// </summary>
/// <typeparam name="TNode">The type of a node.</typeparam>
/// <typeparam name="TKey">The type of a node key.</typeparam>
/// <param name="sources">The set of nodes from which to start the traversal.</param>
/// <param name="key">The function which maps a node to its key.</param>
/// <param name="next">The function which maps a node to its adjacent nodes.</param>
/// <returns>The breadth-first traversal of nodes.</returns>
Performs a breadth-first traversal of a graph or digraph.
Performs a breadth - first traversal of a graph or digraph .
public static IEnumerable<TNode> BreadthFirstTraversal<TNode, TKey>(
            this IEnumerable<TNode> sources,
            Func<TNode, TKey> key,
            Func<TNode, IEnumerable<TNode>> next)
        {
            return BreadthFirstTraversal(sources, key, next, new HashSet<TKey>());
        }
public static IEnumerable < TNode > BreadthFirstTraversal < TNode , TKey > ( this IEnumerable < TNode > sources , Func < TNode , TKey > key , Func < TNode , IEnumerable < TNode > > next ) { return BreadthFirstTraversal ( sources , key , next , new HashSet < TKey > ( ) ) ; }
Performs a breadth-first traversal of a graph or digraph.
Performs a breadth - first traversal of a graph or digraph .
The breadth-first traversal of nodes.
The breadth - first traversal of nodes .
IEnumerable<TNode>
this
key
Func<TNode, TKey>
The function which maps a node to its key.
The function which maps a node to its key .
next
Func<TNode, IEnumerable<TNode>>
The function which maps a node to its adjacent nodes.
The function which maps a node to its adjacent nodes .
sources
The set of nodes from which to start the traversal.
The set of nodes from which to start the traversal .
typeparam
The type of a node.
The type of a node .
typeparam
The type of a node key.
The type of a node key .