Skip to content

Latest commit

 

History

History
12 lines (8 loc) · 831 Bytes

README.md

File metadata and controls

12 lines (8 loc) · 831 Bytes

Breadth First Search

The solutions provided here are utilising the BFS algorithm to traverse a directed, weighted graph with 100 vertices (or nodes) and 376 edges connecting them. The input file (bfs_input.txt) starts with a line that states the number of vertices (nodes) and the number of edges. The following 376 lines (one for each edge) are separated into three columns in the format of starting_node ending_node weight.

The algorithm will traverse the graph from a starting node as given by the user and try to find the shortest path to the ending node as provided by the user. The total weight of the traversal is also displayed in the end.

If the two provided nodes are not connected, an appropriate message will indicate that.

The bfs_results.txt file shows several examples of inputs and outputs for reference.