CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2003
    Location
    Armenia, Yerevan
    Posts
    720

    Need an algo to find a path bewtween 2 vertices of a digraph

    Hi guys, is there any standard algorithm to find any path bewtween any 2 vertices of a digraph? The graph is represented by ajdacency matrix and I need such an algorithm by which I can get the set of vertices (actrually the path) which are on the way from starting vertex to ending vertex.
    I looked for Dijktsra's shortest path but all those version are outputing the min cost of the path, I need a sequence of vertices of the path, in other words there is a path between i-th and j-th vertex, I need this: [i, a1, a2, ..., ai, ..., j]. Also I looked for Depth First Search but this gave just a bool value if such path exiost whenever I need all vertices of the path. Also it is known that there is only 1 path bewtween any 2 vertices.

    Waiting for your inputs.
    Best Regards, David.

  2. #2
    Join Date
    Aug 2002
    Location
    Madrid
    Posts
    4,588

    Re: Need an algo to find a path bewtween 2 vertices of a digraph

    Dijkstra's algorithm also gives you the path in a second step. link.
    Get this small utility to do basic syntax highlighting in vBulletin forums (like Codeguru) easily.
    Supports C++ and VB out of the box, but can be configured for other languages.

  3. #3
    Join Date
    Jun 2003
    Location
    Armenia, Yerevan
    Posts
    720

    Re: Need an algo to find a path bewtween 2 vertices of a digraph

    Thank's, Yves, I solved my problem.

  4. #4
    Join Date
    Nov 2006
    Posts
    1

    Re: problem on Theory of computation

    Good morning sir, I am working as a lecturer in engg collgege(india). i have one doubt on the following question in Theory of computation.

    How many possible number of DFA's exist 2states over alphabet{0,1}.

    a) 16 b) 14 c) 20 d) 24

    give clear explanation. if there is any formulae plz mail to me....

    Thanking u sir.

    Ramesh Karnati
    Last edited by ramesh_krnt; November 20th, 2006 at 12:34 AM. Reason: changing title

  5. #5
    Join Date
    Jun 2002
    Location
    Moscow, Russia.
    Posts
    2,176

    Re: problem on Theory of computation

    Quote Originally Posted by ramesh_krnt
    Good morning sir, I am working as a lecturer in engg collgege(india).


    Given this definition, and assuming automata with permuted states are equivalent, aswer is <write correct answer here>...
    "Programs must be written for people to read, and only incidentally for machines to execute."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured