Assignment On Graph Theory

Added on - 30 Sep 2019

  • 6

    pages

  • 1006

    words

  • 83

    views

  • 0

    downloads

Showing pages 1 to 3 of 6 pages
Input run7y01y03y12y14y34y45y42y63n1021314
152303133344for 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): nMenu: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: 6Menu: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 2Menu:1. Depth First Search (DFS)2. Topological Sort3. Breadth First Search (BFS)4. ExitEnter your choice: 1Enter the starting vertex: 3DFS:
desklib-logo
You’re reading a preview
card-image

To View Complete Document

Become a Desklib Library Member.
Subscribe to our plans

Download This Document