SlideShare uma empresa 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

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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
 

Destaque

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
 

Destaque (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
 

Semelhante a Algorithm to count number of disjoint paths

Semelhante 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

ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
Multi Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP ModuleMulti Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP ModuleCeline George
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptxmary850239
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxkarenfajardo43
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataBabyAnnMotar
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Developmentchesterberbo7
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxMichelleTuguinay1
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmStan Meyer
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdfMr Bounab Samir
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSMae Pangan
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17Celine George
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...DhatriParmar
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operationalssuser3e220a
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
Mental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsMental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsPooky Knightsmith
 

Último (20)

ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
Multi Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP ModuleMulti Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP Module
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped data
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Development
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and Film
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdf
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHS
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operational
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
Mental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsMental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young minds
 
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of EngineeringFaculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
 

Algorithm to count number of disjoint paths