# Assignment On Graph Theory

6 Pages1006 Words482 Views
Input run7 y 0 1 y 0 3 y 1 2 y 1 4 y 3 4 y 4 5 y 4 2 y 6 3 n 1 0 2 1 3 1 4
1 5 2 3 0 3 1 3 3 3 4 4 for above input, output should be:Enter the number of vertices: 7Do you want to enter any edge in the graph? (Y or N): yEnter first vertex v1: 0Enter second vertex v2: 1Do you want to enter any edge in the graph? (Y or N): yEnter first vertex v1: 0Enter second vertex v2: 3Do you want to enter any edge in the graph? (Y or N): yEnter first vertex v1: 1Enter second vertex v2: 2Do you want to enter any edge in the graph? (Y or N): yEnter first vertex v1: 1Enter second vertex v2: 4Do you want to enter any edge in the graph? (Y or N): yEnter first vertex v1: 3Enter second vertex v2: 4Do you want to enter any edge in the graph? (Y or N): yEnter first vertex v1: 4Enter second vertex v2: 5Do you want to enter any edge in the graph? (Y or N): yEnter first vertex v1: 4Enter second vertex v2: 2Do you want to enter any edge in the graph? (Y or N): yEnter first vertex v1: 6Enter second vertex v2: 3
Do you want to enter any edge in the graph? (Y or N): n Menu:1. Depth First Search (DFS)2. Topological Sort3. Breadth First Search (BFS)4. ExitEnter your choice: 1Enter the starting vertex: 0DFS: Vertex visited: 2Vertex visited: 5Vertex visited: 4Vertex visited: 3Vertex visited: 1Vertex visited: 0Vertex visited: 6 Menu:1. Depth First Search (DFS)2. Topological Sort3. Breadth First Search (BFS)4. ExitEnter your choice: 2DFS: Vertex visited: 2Vertex visited: 5Vertex visited: 4Vertex visited: 3Vertex visited: 1Vertex visited: 0Vertex visited: 6Topological Sort: 6 0 1 3 4 5 2 Menu:1. Depth First Search (DFS)2. Topological Sort3. Breadth First Search (BFS)4. ExitEnter your choice: 1Enter the starting vertex: 3DFS:

## End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
|9
|845
|66

|6
|416
|53

|11
|1412
|13

|12
|2453
|21

### Support

#### +1 306 205-2269

Chat with our experts. we are online and ready to help.