Thread: C++ : How to implement Dijkstra' Algorithm in Adjacency Martrix ?

  1. #1
    Registered User
    Join Date
    Apr 2011
    Posts
    1

    C++ : How to implement Dijkstra' Algorithm in Adjacency Martrix ?

    I have attached my source file. I tried a lot but i couldnot create a function to find the shortest path between two vertices. If anybody help me out or atleast help me understand how to use dijkstra's algorithm in adjacency matrix. I will be thankful.

    Here is the adjacency matrix source code. works fine.
    Attachment 10468

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,656
    So what kind of tests did you perform?

    Say for example, start with just two nodes - the answer should be trivial.

    Then try 3 nodes in a straight line.
    Then try 3 nodes in a triangle, with an obvious difference in the path lengths.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 11-06-2008, 11:50 PM
  2. Implement of a Fast Time Series Evaluation Algorithm
    By BiGreat in forum C Programming
    Replies: 7
    Last Post: 12-04-2007, 02:30 AM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM