Use Dijktra's Algorithm & design C++ program

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • shashankbs
    New Member
    • Jan 2009
    • 2

    Use Dijktra's Algorithm & design C++ program

    Given a topology and a certain node X, find the shortest path tree
    with X as the root.

    * Input: a topology file similar to the following (which is a three-node
    ring)

    --------------------------------------------
    Nodes: (3) // there are three nodes (node 0, 1 and 2)

    Edges: (3)
    ID node node cost
    0 0 1 100 // there is an bidirectional edge between
    node 0 & 1, the edge ID is 0, and the cost is 100
    1 1 2 50
    2 2 0 100
    --------------------------------------------

    * Output: Description of the tree as following, the order should be
    based on breadth-first search
    0(0) 1(0) 2(0)

    where A(B) means the parent of node A is node B

    * Requirements:
    - Use standard C++
    - Use of Dijkstra's algorithm is required when finding shortest paths
    - No GUI
    - Platform independent (can be compile under both Windows and Linux)
    - The code must be compilable
    - Use of STL is recommended (but not required)
    - Use of class is required
  • donbock
    Recognized Expert Top Contributor
    • Mar 2008
    • 2427

    #2
    What is Dijkstra's Algorithm?

    Comment

    • shashankbs
      New Member
      • Jan 2009
      • 2

      #3
      Re: Wats Dijkstra's Algorithm

      Dijkstra's algorithm, conceived by Dutch computer scientist Edsger Dijkstra in 1959, [1] is a graph search algorithm that solves the single-source shortest path problem for a graph with non negative edge path costs, outputting a shortest path tree. This algorithm is often used in routing.
      For a given source vertex (node) in the graph, the algorithm finds the path with lowest cost (i.e. the shortest path) between that vertex and every other vertex. It can also be used for finding costs of shortest paths from a single vertex to a single destination vertex by stopping the algorithm once the shortest path to the destination vertex has been determined. For example, if the vertices of the graph represent cities and edge path costs represent driving distances between pairs of cities connected by a direct road, Dijkstra's algorithm can be used to find the shortest route between one city and all other cities. As a result, the shortest path first is widely used in network routing protocols, most notably IS-IS and OSPF (Open Shortest Path First

      Comment

      Working...