Skip to content

Latest commit

 

History

History
13 lines (10 loc) · 513 Bytes

README.md

File metadata and controls

13 lines (10 loc) · 513 Bytes

bfsdfs

Breadth first search and Depth first search on undirected graphs:

Execute make command to compile

The executable "bfs_dfs" takes input as:

  1. Number of vertices
  2. Number of edges
  3. Then it takes all the edges one by one in format v1 v2 where v1, v2 are vertices respectively. 1 <= v1,v2 <= n where n = number of vertices.

Output is both the Breadth First Search and Depth First Search starting from node 1. For disconnected graph, the search will contain multiple lines, one for each component.