SlideShare a Scribd company logo
Algorithm To Count Number of
Disjoint Paths Between A Source
  and Target, In A Given Graph



                      Sujith Nair
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.
Pseudo-Code
disjoint-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;
}
delete_path(G,path){
  for each edge in path
      G:=G-edge;
}
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[];
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;
path:=empty sequence;
    k=Y;
    while (previous[k]!=NULL)
       insert k at the end of path;
       k:=previous[k];

    return path;
}
Example
Source Vertex: a
Target Vertex: f
Example Continued.




                List Of Edge-
                Disjoint Paths:
                1. a-b-f
Example Continued




             List Of Edge-Disjoint
             Paths:
             1.a-b-f
             2.a-c-f
Example Continued




                    List Of Edge-
                    Disjoint Paths:
                    1.a-b-f
                    2.a-c-f
                    3.a-d-c-f
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.
Thank You

More Related Content

What's hot (20)

PPTX
Graph Algorithms: Breadth-First Search (BFS)
Md. Shafiuzzaman Hira
 
PPT
Unit26 shortest pathalgorithm
meisamstar
 
PPT
Maximum flow
Md. Shafiuzzaman Hira
 
PPTX
Shortest path problem
Ifra Ilyas
 
PPTX
Shortest path algorithm
sana younas
 
PPT
(148064384) bfs
Aravindharamanan S
 
PDF
Max Flow Problem
Guillaume Guérard
 
PPT
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
Mohanlal Sukhadia University (MLSU)
 
PPT
SINGLE-SOURCE SHORTEST PATHS
Md. Shafiuzzaman Hira
 
PDF
Skiena algorithm 2007 lecture12 topological sort connectivity
zukun
 
PPTX
Minimum cost maximum flow
SaruarChowdhury
 
PPTX
Ford Fulkerson Algorithm
Adarsh Rotte
 
PPT
chapter22.ppt
Tareq Hasan
 
PPT
Data structure
sumit singh
 
PPTX
Data structures and algorithms lab7
Bianca Teşilă
 
PPTX
Network flows
Luckshay Batra
 
PPT
Max flow min cut
Mayank Garg
 
PPTX
Network flows
Richa Bandlas
 
PDF
Algorithms of graph
getacew
 
Graph Algorithms: Breadth-First Search (BFS)
Md. Shafiuzzaman Hira
 
Unit26 shortest pathalgorithm
meisamstar
 
Maximum flow
Md. Shafiuzzaman Hira
 
Shortest path problem
Ifra Ilyas
 
Shortest path algorithm
sana younas
 
(148064384) bfs
Aravindharamanan S
 
Max Flow Problem
Guillaume Guérard
 
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
Mohanlal Sukhadia University (MLSU)
 
SINGLE-SOURCE SHORTEST PATHS
Md. Shafiuzzaman Hira
 
Skiena algorithm 2007 lecture12 topological sort connectivity
zukun
 
Minimum cost maximum flow
SaruarChowdhury
 
Ford Fulkerson Algorithm
Adarsh Rotte
 
chapter22.ppt
Tareq Hasan
 
Data structure
sumit singh
 
Data structures and algorithms lab7
Bianca Teşilă
 
Network flows
Luckshay Batra
 
Max flow min cut
Mayank Garg
 
Network flows
Richa Bandlas
 
Algorithms of graph
getacew
 

Viewers also liked (18)

PPT
Maths Games & Videos
Suhaila
 
PDF
Print maths loop games (print)
Michelle Moloney
 
PDF
Myself
Michelle Moloney
 
PPT
Students Rule 11
Gretchen Eastman
 
PPTX
Maths
KMURALIKUMAR
 
PDF
slidespdf
aman gour
 
PPTX
2015 Maths Information Evening
bazntam
 
PPTX
Maths &Fun
Mihaela Git
 
PPTX
Adding Fractions Mathematics GCSE Maths
How2Become.com
 
PPT
Recreational Mathematics
MRIDUL GUPTA
 
PPTX
Healthy Living and Healthy Eating EDU 290 Powerpoint
Kris Barron
 
PDF
How The Love of Music has changed our Business World
Thorsten Faltings
 
PPTX
EdTech Europe 2015 [Track 3]: [Mangahigh], ([Mohit Midha], [COO])
EdTech Europe
 
PDF
Blazing Performance with Flame Graphs
Brendan Gregg
 
PPTX
Powerpoint on class rules
Shodge2
 
PPTX
Applications of mathematics in our daily life
Abhinav Somani
 
PPTX
lesson plan elements of short story
Mhelane Herebesi
 
PPT
Elements of Short Story
Virginia Vidar
 
Maths Games & Videos
Suhaila
 
Print maths loop games (print)
Michelle Moloney
 
Students Rule 11
Gretchen Eastman
 
slidespdf
aman gour
 
2015 Maths Information Evening
bazntam
 
Maths &Fun
Mihaela Git
 
Adding Fractions Mathematics GCSE Maths
How2Become.com
 
Recreational Mathematics
MRIDUL GUPTA
 
Healthy Living and Healthy Eating EDU 290 Powerpoint
Kris Barron
 
How The Love of Music has changed our Business World
Thorsten Faltings
 
EdTech Europe 2015 [Track 3]: [Mangahigh], ([Mohit Midha], [COO])
EdTech Europe
 
Blazing Performance with Flame Graphs
Brendan Gregg
 
Powerpoint on class rules
Shodge2
 
Applications of mathematics in our daily life
Abhinav Somani
 
lesson plan elements of short story
Mhelane Herebesi
 
Elements of Short Story
Virginia Vidar
 
Ad

Similar to Algorithm to count number of disjoint paths (20)

PPT
The Floyd–Warshall algorithm
José Juan Herrera
 
PPTX
Introduction to graphs
Venus Desiar
 
PPTX
Implementation of graphs, adjaceny matrix
VatsalSharma64
 
PPTX
DIJKSTRA_123.pptx
KrishnaSawant8
 
PPT
Graphs
Saurabh Mishra
 
PDF
Lecture 16 - Dijkstra's Algorithm.pdf
iftakhar8
 
PPTX
logic.pptx
KENNEDY GITHAIGA
 
PDF
Unit-10 Graphs .pdf
Yatru Harsha Hiski
 
PPTX
Dijkstra
jagdeeparora86
 
PPT
Shortest path
Ruchika Sinha
 
PPTX
Graph Algorithms
Ashwin Shiv
 
DOCX
Shortest Path Problem.docx
SeethaDinesh
 
PPTX
15-bellmanFord.pptx...........................................
ejazayesha485
 
PPTX
ppt 1.pptx
ShasidharaniD
 
PPTX
130210107039 2130702
Ketaki_Pattani
 
PPT
Dijkstra's algorithm for computer science
ajmalnajath4
 
PDF
Link Prediction in the Real World
Balaji Ganesan
 
PDF
Djikstra’s Algorithm. Approach to shortest path algorithm with greedy method
khushigdgjdcoem
 
PPT
Dijkstra c
shrikant00786
 
The Floyd–Warshall algorithm
José Juan Herrera
 
Introduction to graphs
Venus Desiar
 
Implementation of graphs, adjaceny matrix
VatsalSharma64
 
DIJKSTRA_123.pptx
KrishnaSawant8
 
Lecture 16 - Dijkstra's Algorithm.pdf
iftakhar8
 
logic.pptx
KENNEDY GITHAIGA
 
Unit-10 Graphs .pdf
Yatru Harsha Hiski
 
Dijkstra
jagdeeparora86
 
Shortest path
Ruchika Sinha
 
Graph Algorithms
Ashwin Shiv
 
Shortest Path Problem.docx
SeethaDinesh
 
15-bellmanFord.pptx...........................................
ejazayesha485
 
ppt 1.pptx
ShasidharaniD
 
130210107039 2130702
Ketaki_Pattani
 
Dijkstra's algorithm for computer science
ajmalnajath4
 
Link Prediction in the Real World
Balaji Ganesan
 
Djikstra’s Algorithm. Approach to shortest path algorithm with greedy method
khushigdgjdcoem
 
Dijkstra c
shrikant00786
 
Ad

Recently uploaded (20)

PPTX
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
PPTX
SCHOOL-BASED SEXUAL HARASSMENT PREVENTION AND RESPONSE WORKSHOP
komlalokoe
 
PPTX
Views on Education of Indian Thinkers Mahatma Gandhi.pptx
ShrutiMahanta1
 
PPTX
Explorando Recursos do Summer '25: Dicas Essenciais - 02
Mauricio Alexandre Silva
 
PPTX
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
PDF
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
PDF
1, 2, 3… E MAIS UM CICLO CHEGA AO FIM!.pdf
Colégio Santa Teresinha
 
PPTX
HEAD INJURY IN CHILDREN: NURSING MANAGEMENGT.pptx
PRADEEP ABOTHU
 
PPTX
Accounting Skills Paper-I, Preparation of Vouchers
Dr. Sushil Bansode
 
PPTX
Pyhton with Mysql to perform CRUD operations.pptx
Ramakrishna Reddy Bijjam
 
PDF
Zoology (Animal Physiology) practical Manual
raviralanaresh2
 
PPTX
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
PPTX
How to Create Rental Orders in Odoo 18 Rental
Celine George
 
PDF
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
PDF
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
PPTX
How to Configure Access Rights of Manufacturing Orders in Odoo 18 Manufacturing
Celine George
 
PPTX
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
PPTX
How to Configure Storno Accounting in Odoo 18 Accounting
Celine George
 
PDF
community health nursing question paper 2.pdf
Prince kumar
 
PPTX
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
SCHOOL-BASED SEXUAL HARASSMENT PREVENTION AND RESPONSE WORKSHOP
komlalokoe
 
Views on Education of Indian Thinkers Mahatma Gandhi.pptx
ShrutiMahanta1
 
Explorando Recursos do Summer '25: Dicas Essenciais - 02
Mauricio Alexandre Silva
 
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
1, 2, 3… E MAIS UM CICLO CHEGA AO FIM!.pdf
Colégio Santa Teresinha
 
HEAD INJURY IN CHILDREN: NURSING MANAGEMENGT.pptx
PRADEEP ABOTHU
 
Accounting Skills Paper-I, Preparation of Vouchers
Dr. Sushil Bansode
 
Pyhton with Mysql to perform CRUD operations.pptx
Ramakrishna Reddy Bijjam
 
Zoology (Animal Physiology) practical Manual
raviralanaresh2
 
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
How to Create Rental Orders in Odoo 18 Rental
Celine George
 
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
How to Configure Access Rights of Manufacturing Orders in Odoo 18 Manufacturing
Celine George
 
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
How to Configure Storno Accounting in Odoo 18 Accounting
Celine George
 
community health nursing question paper 2.pdf
Prince kumar
 
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 

Algorithm to count number of disjoint paths