[Tutor] Help needed with Python programming

Suhana Vidyarthi suhanavidyarthi at gmail.com
Tue Apr 22 03:16:20 CEST 2014

My knowledge of coding is fairly limited and I am having a hard time
writing a Python code which might be pretty simple for you :-)

Here is what I am doing and I need help with:

I have a python code that shows a set of shortest paths between nodes A and
B. Now I have to select the least risky path among them. To do that I have
to consider the risk values of each link. I know how to calculate the
path's risk using its link value.

For example: There is a path between node A and B wiht two links.
Probability of failure for link 1 is 0.001 and for link 2 is 0.003. Here is
the link with its risk values:
                  A o--------------------o---------------------o B
                                           0.001               0.003
So the probability of the link being down will be: 1 - (0.999 x 0.997) =

You can find the attached file with disaster risk values of each link.

For instance; first line is : 1,3,5,0.03   --> this means, first disaster
affects links 1-3 and 5-0 and its occurrence rate is 0.03. So you need to
assign link (1-3)'s risk to 0.03.
Then you will continue with the next disaster which is the one in the next
line. Note that, if a link gets affected by 2 disasters, you will add the
probability of those 2 disasters to find that link's risk.

If anyone can help me code the first line, I will be able to do the rest.
You need use "array list" and some functions like "file reader" and
"delimiter" I guess.

Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140421/2aea7b16/attachment.html>
-------------- next part --------------

More information about the Tutor mailing list