Help needed Breadth First Search & Depth First Search

Discussion in 'C' started by luckyali444, Jan 17, 2012.

  1. luckyali444

    luckyali444 New Member

    Joined:
    Jan 5, 2012
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Hello there, i have a Metrics of 5X5 vertices. I want the implement BFS and DFS. First of all BFS.

    here is my Metrics


    v1 v2 v3 v4 v5

    v1 0 1 0 0 1
    v2 1 0 1 1 1
    v3 0 1 0 1 0
    v4 0 1 1 0 1
    v5 1 1 0 1 0


    Tell me please if i am wrong..

    Breadth First Search
    ==============


    Step 1: Add the Vertex V1 in a Queue and process all of its neighbors

    Step 2: Once neighbors are processed, delete the Vertex V1 from Queue.

    Step 3: Repeat the 1st and 2nd step until you dealt with all Vertices.




    Depth First Search
    =============


    Please give me an idea about DFS so that i can go ahead and implement it by my own.



    Thank you so much
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice