<div dir="ltr"><div><div><div><div>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
:-)<br><br></div>Here is what I am doing and I need help with:<br>
<br></div>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.<br>
<br></div><div>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<br> 0.001 0.003<br></div><div>So the probability of the link being down will be: 1 - (0.999 x 0.997) = 0.996003<br>
<br></div>You can find the attached file with disaster risk values of each link. <br><div><br>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. </div>
<div>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.<br><br></div>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.<br><br></div>Thanks in advance.<br></div>