Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Open Source > Python
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Python section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Display Modes
  #1 (permalink)  
Old March 11th, 2011, 06:21 PM
Registered User
Join Date: Mar 2011
Posts: 7
Thanks: 2
Thanked 0 Times in 0 Posts
Default Dijkstras Algorithm


I am writing a python script that implements Dijkstras Open Shortest Path First Algorithm.

My plan is to read in 2 text files,

network.txt, which is a multi-line file, with node, nearest neighbour and distance metric info:

(this is just the distance metric info, the other details will be added when the file gets read into a list in the script)


and route.txt which is a single line file with start and destination information:

(this is only a starting point, as it will get updated within the algorithm)


once the algorithm has run, i want to produce an output file called spf.txt which contains the shortest path from source to destination.

If anyone could give me some pointers on how to approach this that would be awesome!


Reply With Quote
  #2 (permalink)  
Old March 24th, 2011, 02:18 AM
Registered User
Join Date: Mar 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts

Hi Martin,

Would you please elaborate on the contents of the file "network.txt"?

You mention "multi-line file, with node, nearest neighbour and distance metric info", but you don't say where the information is coming from other than "the other details will be added when the file gets read into a list in the script".

Where is the information coming from in order to be read into the list? What does the information look like? Is "network.txt" an input file that provides information to the Python script or an output file wherein the script dumps a graph of the network?

Note that the book OSPF and IS-IS: Choosing an IGP for Large-Scale Networks by Jeff Doyle has a good description of Dijkstra's algorithm and the data needed to produce a routing table (pages 50-62). Perhaps this will provide the hints you need.

Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
apriori algorithm iralala J2EE 4 January 1st, 2014 05:49 PM
Can someone help me with this algorithm please! th kishan4910 VB How-To 18 February 5th, 2008 06:15 AM
algorithm angelboy Other Programming Languages 0 April 14th, 2007 08:56 AM
Typical Algorithm rajanikrishna ASP.NET 1.0 and 1.1 Professional 0 November 20th, 2006 02:05 AM
Algorithm kvanchi General .NET 3 January 20th, 2005 04:28 AM

All times are GMT -4. The time now is 09:20 AM.

Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.