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

This is a discussion on C++ : How to implement Dijkstra' Algorithm in Adjacency Martrix ? within the C++ Programming forums, part of the General Programming Boards category; I have attached my source file. I tried a lot but i couldnot create a function to find the shortest ...

  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.
    g.cpp

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,422
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 11-06-2008, 10:50 PM
  2. Implement of a Fast Time Series Evaluation Algorithm
    By BiGreat in forum C Programming
    Replies: 7
    Last Post: 12-04-2007, 01: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, 09:33 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21