Short

This is a discussion on Short within the C++ Programming forums, part of the General Programming Boards category; I am presently designing a simulator to find the shortest route between 2 noded say A and B. I have ...

  1. #1
    Its not rocket science vasanth's Avatar
    Join Date
    Jan 2002
    Posts
    1,683

    Short

    I am presently designing a simulator to find the shortest route between 2 noded say A and B. I have finished the interface and input interfacr from the user and i am using linked list... I am able to arrive at an array.. eg:-
    Code:
              A          B          C          D         E        
    
    A       0           2          -          1          2        
    
    B       2           0          1          -          1
    
    C       -            1          0          4         5
    
    D       1            -          4          0         2
    
    E       2            1          5          2        0

    now this matrix represents all the nodes and the distance between them... "-" eans that there is no direct route between the two.. Now i want to find the shortest route beween 2 nodes.. say for example between A to C. So any algorithm or help woul be appreciated....

    The network for the above matrix may look like this..
    Code:
                               A -'------2--------B
                               |      '2        1 '   |
                               1       '   E  '       1
                               |      2'        '5    |
                               D--'------4----'---C
    So the shortest route for the above is A to B to C that is 2 + 1 =3
    The above example and matrix for that was a simple one.. But i have to do this for say 1000 noes sometimes... with all possible routes.. with all kinds of distance....

    So any help,algorithms,links,code snipets etc etc would be appreciated..


    Thanx in Advance
    Last edited by vasanth; 12-13-2002 at 12:57 PM.

  2. #2
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,386
    Last edited by Shiro; 12-13-2002 at 01:16 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Accessing Structures Inside Structures
    By Mellowz in forum C Programming
    Replies: 1
    Last Post: 01-13-2008, 03:55 AM
  2. Help calling function is asm
    By brietje698 in forum C++ Programming
    Replies: 24
    Last Post: 12-06-2007, 04:48 PM
  3. Say what? - Weird error.
    By Blackroot in forum C++ Programming
    Replies: 6
    Last Post: 08-16-2006, 12:54 AM
  4. Color Variety
    By Unregistered in forum C++ Programming
    Replies: 7
    Last Post: 10-23-2002, 10:17 AM
  5. My Allegro Program will not run...
    By Vicious in forum Game Programming
    Replies: 17
    Last Post: 06-14-2002, 01:49 AM

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