Upcoming SlideShare
×

Algorithm to count number of disjoint paths

1,131
-1

Published on

A simple algorithm I devised to enumerate the disjoint paths between a pair of vertices in a given graph. This algorithm was devised as a part of my course-work for Masters [Tech.] at IIT-Banaras Hindu University.

Published in: Education
0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
Your message goes here
• Be the first to comment

• Be the first to like this

Views
Total Views
1,131
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
6
0
Likes
0
Embeds 0
No embeds

No notes for slide

Algorithm to count number of disjoint paths

1. 1. Algorithm To Count Number ofDisjoint Paths Between A Source and Target, In A Given Graph Sujith Nair
2. 2. Introduction• This algorithm finds all the edge-disjoint paths between a source S ∈ V and a target T ∈ V, in a given graph G(E,V).• The algorithm uses Dijkstra’s Single-Source- Shortest-Path algorithm as a sub-routine.
3. 3. Pseudo-Codedisjoint-path(G[n][n],X,Y){ path=path_find(X,Y); while(path!=NULL){ count++; delete_path(G,path); path=path_find(X,Y); } return count;}
4. 4. delete_path(G,path){ for each edge in path G:=G-edge;}
5. 5. path_find(G,X,Y){ for each vertex V in G: dist[v]:=infinity; previous[v]:= undefined; dist[x]:=0; Q:= set of all nodes in G; while Q is not empty u:=vertex in Q with smallest distance in dist[];
6. 6. If dist[u]=infinity: break;remove u from Q;for each neighbour v of u: alt:= dist[u]+1; if alt<dist[v]: dist[v]:=alt; previous[v]=u;
7. 7. path:=empty sequence; k=Y; while (previous[k]!=NULL) insert k at the end of path; k:=previous[k]; return path;}
8. 8. ExampleSource Vertex: aTarget Vertex: f
9. 9. Example Continued. List Of Edge- Disjoint Paths: 1. a-b-f
10. 10. Example Continued List Of Edge-Disjoint Paths: 1.a-b-f 2.a-c-f
11. 11. Example Continued List Of Edge- Disjoint Paths: 1.a-b-f 2.a-c-f 3.a-d-c-f
12. 12. Endnotes• This algorithm will also work in the case of weighted graphs. In the case of weighted graphs, the algorithm returns a list of paths with the lowest weights.• This algorithm, with minor modifications, will also work for the case of vertex-disjoint paths.
13. 13. Thank You
1. A particular slide catching your eye?

Clipping is a handy way to collect important slides you want to go back to later.