A look at breadth-first search in C# for traversing graphs. Breadth-first search is very similar to depth-first search, except that it internally uses a Queue instead of a Stack when traversing the graph. In the case of an unweighted graph, breadth-first search can also find the shortest path between two vertices in a graph.

Read MoreProgram and use the depth-first search algorithm in C# and .NET Core to find all the vertices that can be reached in an undirected graph given a starting vertex. Depth-first search helps answer the question of connectivity, and is useful for mapping physical networks, web pages, social networks, etc. There are recursive and iterative versions of depth-first search, and this article will show the iterative version that requires an extra Stack Data Structure to maintain vertices visited.

Read More