SlideShare una empresa de Scribd logo
1 de 13
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

Más contenido relacionado

La actualidad más candente

Graph Algorithms: Breadth-First Search (BFS)
Graph Algorithms: Breadth-First Search (BFS)Graph Algorithms: Breadth-First Search (BFS)
Graph Algorithms: Breadth-First Search (BFS)Md. Shafiuzzaman Hira
 
Unit26 shortest pathalgorithm
Unit26 shortest pathalgorithmUnit26 shortest pathalgorithm
Unit26 shortest pathalgorithmmeisamstar
 
Shortest path problem
Shortest path problemShortest path problem
Shortest path problemIfra Ilyas
 
Shortest path algorithm
Shortest path algorithmShortest path algorithm
Shortest path algorithmsana younas
 
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)Mohanlal Sukhadia University (MLSU)
 
Skiena algorithm 2007 lecture12 topological sort connectivity
Skiena algorithm 2007 lecture12 topological sort connectivitySkiena algorithm 2007 lecture12 topological sort connectivity
Skiena algorithm 2007 lecture12 topological sort connectivityzukun
 
Minimum cost maximum flow
Minimum cost maximum flowMinimum cost maximum flow
Minimum cost maximum flowSaruarChowdhury
 
Ford Fulkerson Algorithm
Ford Fulkerson AlgorithmFord Fulkerson Algorithm
Ford Fulkerson AlgorithmAdarsh Rotte
 
Data structures and algorithms lab7
Data structures and algorithms lab7Data structures and algorithms lab7
Data structures and algorithms lab7Bianca Teşilă
 
Max flow min cut
Max flow min cutMax flow min cut
Max flow min cutMayank Garg
 
Algorithms of graph
Algorithms of graphAlgorithms of graph
Algorithms of graphgetacew
 

La actualidad más candente (20)

Graph Algorithms: Breadth-First Search (BFS)
Graph Algorithms: Breadth-First Search (BFS)Graph Algorithms: Breadth-First Search (BFS)
Graph Algorithms: Breadth-First Search (BFS)
 
Unit26 shortest pathalgorithm
Unit26 shortest pathalgorithmUnit26 shortest pathalgorithm
Unit26 shortest pathalgorithm
 
Maximum flow
Maximum flowMaximum flow
Maximum flow
 
Shortest path problem
Shortest path problemShortest path problem
Shortest path problem
 
Shortest path algorithm
Shortest path algorithmShortest path algorithm
Shortest path algorithm
 
(148064384) bfs
(148064384) bfs(148064384) bfs
(148064384) bfs
 
Max Flow Problem
Max Flow ProblemMax Flow Problem
Max Flow Problem
 
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
 
SINGLE-SOURCE SHORTEST PATHS
SINGLE-SOURCE SHORTEST PATHS SINGLE-SOURCE SHORTEST PATHS
SINGLE-SOURCE SHORTEST PATHS
 
Skiena algorithm 2007 lecture12 topological sort connectivity
Skiena algorithm 2007 lecture12 topological sort connectivitySkiena algorithm 2007 lecture12 topological sort connectivity
Skiena algorithm 2007 lecture12 topological sort connectivity
 
Minimum cost maximum flow
Minimum cost maximum flowMinimum cost maximum flow
Minimum cost maximum flow
 
Ford Fulkerson Algorithm
Ford Fulkerson AlgorithmFord Fulkerson Algorithm
Ford Fulkerson Algorithm
 
chapter22.ppt
chapter22.pptchapter22.ppt
chapter22.ppt
 
Data structure
Data structureData structure
Data structure
 
Data structures and algorithms lab7
Data structures and algorithms lab7Data structures and algorithms lab7
Data structures and algorithms lab7
 
CSE633
CSE633CSE633
CSE633
 
Network flows
Network flowsNetwork flows
Network flows
 
Max flow min cut
Max flow min cutMax flow min cut
Max flow min cut
 
Network flows
Network flowsNetwork flows
Network flows
 
Algorithms of graph
Algorithms of graphAlgorithms of graph
Algorithms of graph
 

Destacado

Maths Games & Videos
Maths Games & VideosMaths Games & Videos
Maths Games & VideosSuhaila
 
Print maths loop games (print)
Print maths loop games (print)Print maths loop games (print)
Print maths loop games (print)Michelle Moloney
 
2015 Maths Information Evening
2015 Maths Information Evening2015 Maths Information Evening
2015 Maths Information Eveningbazntam
 
Adding Fractions Mathematics GCSE Maths
Adding Fractions Mathematics GCSE MathsAdding Fractions Mathematics GCSE Maths
Adding Fractions Mathematics GCSE MathsHow2Become.com
 
Recreational Mathematics
Recreational MathematicsRecreational Mathematics
Recreational MathematicsMRIDUL GUPTA
 
Healthy Living and Healthy Eating EDU 290 Powerpoint
Healthy Living and Healthy Eating EDU 290 PowerpointHealthy Living and Healthy Eating EDU 290 Powerpoint
Healthy Living and Healthy Eating EDU 290 PowerpointKris Barron
 
How The Love of Music has changed our Business World
How The Love of Music has changed our Business WorldHow The Love of Music has changed our Business World
How The Love of Music has changed our Business WorldThorsten Faltings
 
EdTech Europe 2015 [Track 3]: [Mangahigh], ([Mohit Midha], [COO])
EdTech Europe 2015 [Track 3]: [Mangahigh], ([Mohit Midha], [COO])EdTech Europe 2015 [Track 3]: [Mangahigh], ([Mohit Midha], [COO])
EdTech Europe 2015 [Track 3]: [Mangahigh], ([Mohit Midha], [COO])EdTech Europe
 
Blazing Performance with Flame Graphs
Blazing Performance with Flame GraphsBlazing Performance with Flame Graphs
Blazing Performance with Flame GraphsBrendan Gregg
 
Powerpoint on class rules
Powerpoint on class rulesPowerpoint on class rules
Powerpoint on class rulesShodge2
 
Applications of mathematics in our daily life
Applications of mathematics in our daily lifeApplications of mathematics in our daily life
Applications of mathematics in our daily lifeAbhinav Somani
 
lesson plan elements of short story
lesson plan elements of short storylesson plan elements of short story
lesson plan elements of short storyMhelane Herebesi
 
Elements of Short Story
Elements of Short StoryElements of Short Story
Elements of Short StoryVirginia Vidar
 

Destacado (18)

Maths Games & Videos
Maths Games & VideosMaths Games & Videos
Maths Games & Videos
 
Print maths loop games (print)
Print maths loop games (print)Print maths loop games (print)
Print maths loop games (print)
 
Myself
MyselfMyself
Myself
 
Students Rule 11
Students Rule 11Students Rule 11
Students Rule 11
 
Maths
MathsMaths
Maths
 
slidespdf
slidespdfslidespdf
slidespdf
 
2015 Maths Information Evening
2015 Maths Information Evening2015 Maths Information Evening
2015 Maths Information Evening
 
Maths &Fun
Maths &FunMaths &Fun
Maths &Fun
 
Adding Fractions Mathematics GCSE Maths
Adding Fractions Mathematics GCSE MathsAdding Fractions Mathematics GCSE Maths
Adding Fractions Mathematics GCSE Maths
 
Recreational Mathematics
Recreational MathematicsRecreational Mathematics
Recreational Mathematics
 
Healthy Living and Healthy Eating EDU 290 Powerpoint
Healthy Living and Healthy Eating EDU 290 PowerpointHealthy Living and Healthy Eating EDU 290 Powerpoint
Healthy Living and Healthy Eating EDU 290 Powerpoint
 
How The Love of Music has changed our Business World
How The Love of Music has changed our Business WorldHow The Love of Music has changed our Business World
How The Love of Music has changed our Business World
 
EdTech Europe 2015 [Track 3]: [Mangahigh], ([Mohit Midha], [COO])
EdTech Europe 2015 [Track 3]: [Mangahigh], ([Mohit Midha], [COO])EdTech Europe 2015 [Track 3]: [Mangahigh], ([Mohit Midha], [COO])
EdTech Europe 2015 [Track 3]: [Mangahigh], ([Mohit Midha], [COO])
 
Blazing Performance with Flame Graphs
Blazing Performance with Flame GraphsBlazing Performance with Flame Graphs
Blazing Performance with Flame Graphs
 
Powerpoint on class rules
Powerpoint on class rulesPowerpoint on class rules
Powerpoint on class rules
 
Applications of mathematics in our daily life
Applications of mathematics in our daily lifeApplications of mathematics in our daily life
Applications of mathematics in our daily life
 
lesson plan elements of short story
lesson plan elements of short storylesson plan elements of short story
lesson plan elements of short story
 
Elements of Short Story
Elements of Short StoryElements of Short Story
Elements of Short Story
 

Similar a Algorithm to count number of disjoint paths

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

Inroduction_To_Algorithms_Lect14
Inroduction_To_Algorithms_Lect14Inroduction_To_Algorithms_Lect14
Inroduction_To_Algorithms_Lect14
 
Unit ix graph
Unit   ix    graph Unit   ix    graph
Unit ix graph
 
Unit 9 graph
Unit   9 graphUnit   9 graph
Unit 9 graph
 
Single source shortes path in dag
Single source shortes path in dagSingle source shortes path in dag
Single source shortes path in dag
 
Shortest Path Problem.docx
Shortest Path Problem.docxShortest Path Problem.docx
Shortest Path Problem.docx
 
Ppt 1
Ppt 1Ppt 1
Ppt 1
 
Temporal graph
Temporal graphTemporal graph
Temporal graph
 
Dijkstra.ppt
Dijkstra.pptDijkstra.ppt
Dijkstra.ppt
 
14 chapter9 graph_algorithmstopologicalsort_shortestpath
14 chapter9 graph_algorithmstopologicalsort_shortestpath14 chapter9 graph_algorithmstopologicalsort_shortestpath
14 chapter9 graph_algorithmstopologicalsort_shortestpath
 
Lecture_10_Parallel_Algorithms_Part_II.ppt
Lecture_10_Parallel_Algorithms_Part_II.pptLecture_10_Parallel_Algorithms_Part_II.ppt
Lecture_10_Parallel_Algorithms_Part_II.ppt
 
Chap10 slides
Chap10 slidesChap10 slides
Chap10 slides
 
Daa chpater14
Daa chpater14Daa chpater14
Daa chpater14
 
Algorithm Design and Complexity - Course 10
Algorithm Design and Complexity - Course 10Algorithm Design and Complexity - Course 10
Algorithm Design and Complexity - Course 10
 
Graphs
GraphsGraphs
Graphs
 
Graph 3
Graph 3Graph 3
Graph 3
 
Graph 1
Graph 1Graph 1
Graph 1
 
Graphs
GraphsGraphs
Graphs
 
Chap10 slides
Chap10 slidesChap10 slides
Chap10 slides
 
1535 graph algorithms
1535 graph algorithms1535 graph algorithms
1535 graph algorithms
 
path
pathpath
path
 

Último

Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdfssuserdda66b
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 

Último (20)

Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 

Algorithm to count number of disjoint paths