SlideShare a Scribd company logo
1 of 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

More Related Content

What's hot

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
 

What's hot (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
 

Viewers also liked

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
 

Viewers also liked (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 to Algorithm to count number of disjoint paths

Similar to 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
 

Recently uploaded

Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
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
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 

Recently uploaded (20)

Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
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...
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 

Algorithm to count number of disjoint paths