SlideShare ist ein Scribd-Unternehmen logo
1 von 22
Presentation on prolog :
    Dijkstra’s Algorithm
A graph is defined as a set
of nodes and a set of edges, where
each edge is a pair of nodes.
There are several ways to
represent graphs in Prolog.
 One method is to represent each edge separately as one
 clause (fact).
                  • edge(1, 5). edge(1, 7). edge(2, 1). edge(2, 7). edge(3, 1). edge(3, 6).
                    edge(4, 3). edge(4, 5). edge(5, 8). edge(6, 4). edge(6, 5). edge(7, 5).
                    edge(8, 6). edge(8, 7).



                                    We call this edge-clause form
                        W
 Another method is to represent the whole graph as one
 data object. According to the definition of the graph as
 a pair of two sets (nodes and edges).
   EXAMPLE :
        graph([b,c,d,f,g,h,k],[e(b,c),e(b,f),e(c,f),e(f,k),e(g,h)]) .



   We call this graph-term form. Note, that the lists are
    kept sorted, they are really sets, without duplicated
    elements. Each edge appears only once in the edge list.

   The graph-term form is a default representation
 A third representation method is to associate with
 each node the set of nodes that are adjacent to that
 node .

 EXAMPLE:
          [n(b,[c,f]), n(c,[b,f]), n(d,[]), n(f,[b,c,k]), .........].
      
Directed graphs
  These are represented by ordered pairs
  To represent a directed graph, the forms discussed
  above are slightly modified. The example graph is
  represented as follows:
    When the edges are directed we call them arcs
         Arc-clause form
     

                 arc(s,u).
                 arc(u,r).
         Graph-term form
     
                 digraph([r,s,t,u,v],[a(s,r),a(s,u),a(u,r),a(u,s),a(v,u)])
         Adjacency-list form
     

                 [n(r,[]),n(s,[r,u]),n(t,[]),n(u,[r]),n(v,[u])]
Dijkstra
 Dijkstra's algorithm, introduced by the dutch
  computer scientist , is a graph searching algorithm.

 Dijkstra’s algorithm is used to solve the problems of
  finding the shortest path between edge - weighted
  graphs in which all the weights are non-negative.
Basic features of
Dijkstra's algorithm
 For a given source vertices it finds the lowest cost(i.e.
  The shortest path) for every other vertices .

 It can also be used to find the lowest cost for a
  particular destination by the stopping the algorithm in
  between.

 For example:- If the vertices represents the cities and
  the edge path cost represents the distance between
  pair cities then dijkstra’s can be used to find the
  shortest route between one city and all other.
An example of
    Dijkstra’s Algorithm
Dijkstra’s Algorithm can be applied to
   network routing, as it can be used to find
the shortest path from any source computer
      to any other computer in the network .
Basic steps towards the algorithm
 The algorithm begins by initializing any vertex in the graph
 (vertex A, for example) a permanent label with the value of
 0, and all other vertices a temporary label with the value of
 0.
Basic steps towards
 The algorithm then proceeds to select the least cost edge
 connecting a vertex with a permanent label (currently vertex
 A) to a vertex with a temporary label (vertex B, for
 example). Vertex B's label is then updated from a temporary
 to a permanent label. Vertex B's value is then determined by
 the addition of the cost of the edge with vertex A's value
Basic steps towards

 The next step is to find the next least cost edge
  extending to a vertex with a temporary label from
  either vertex A or vertex B (vertex C, for
  example), change vertex C's label to permanent, and
  determine its distance to vertex A.
Basic steps towards
This process is repeated until the labels of all vertices in the
graph are permanent.
Start


                     Identify source node and
                   destination node as V1 and V2


                          Set V1 as T-node



   Set T-node’s label to “permanent” and update
   neighbor's status record set


        Identify the tentative node linked to V1 that has the
        lowest weight and set it as T-node


                           Is T-Node is
                                V2?                             END

Based on information in status record set, do these until u
reach V1. The string of link represents the best route
dijkstra(Graph,MinDist,[],MinDist).
                      dijkstra(Graph,Closed,Open,MinDist):-
                               min(Open,V-D,ReducedOpen),
                           adjacent(Graph,V,AdjacentNodes),
                  diff(AdjacentNodes,Closed,PrunedNodes),
           addDist(PrunedNodes,D,UpdatedPrunedNodes),
nodeMerge(UpdatedPrunedNodes,ReducedOpen,NextOpen),
          dijkstra(Graph,[V-D|Closed],NextOpen,MinDist).
Rules which are used above in the
pesudo code
  min(L,Min,Rest):-
   The method min above takes a list L and puts the smallest
   value in the MIN with the smallest value in L and Rest with
   a list containing all values in L excluding Min.
  adjacent(Graph,Node,Adj) which is true if Adj is a list of all
   nodes reachable from the node Node in one hop in Graph.
   Node is of the form of a single graph vertex label (i.e. the
   minimum cost is not included), Adj should be a list of
   node-cost pairs.
  For example, given the query adjacent([a-b-1,a-c-2,b-a-4,b-
   c-1],a,A) Prolog should return A = [b-1,c-2]
Rules which are used above in the
pesudo code


  diff(L,M,N) takes a list L and a list M and unifies N
   with a list containing all items in L which are not in M.
   The list L is assumed to contain no duplicate elements.

  addDist(Nodes, D, NewNodes) which is true if
   NewNodes is a list containing all the nodes in Nodes
   with their edge cost incremented by D.
Rules which are used above in the
pesudo code
  nodeMerge(A,B,C) which merge lists A and B together
  and unifies the result in C. Lists A, B and C contain no
  duplicate elements: i.e. within the each list there is no
  pair of nodes V1,V2 such that V1=V2.
In today’s world, networking plays an important role in
                         communication between autonomous
     computers. For this many hardware devices and software
                         algorithms have been designed. So far,
  the traditional system used for the communication were the
                              hub networking system and many
other hardware applications present in the market, but as they
                               operate on electricity, it may lead
    to the failure of device due to some malfunctioning in the
          hardware circuitry. Dijkstra Algorithm provides easy
                    understandability and hence its chances of
                                             failure is negligible.
References
http://students.ceid.upatras.gr/~papagel/project/kef5_7_1.htm

 http://www.animal.ahrgr.de/showAnimationDetails.php3?lang=en&anim=
    16

 http://www.cs.sunysb.edu/~skiena/combinatorica/animations/dijkstra.ht
    ml

 http://www.ibiblio.org/links/devmodules/graph_networking/xhtml/page13
    .xml

 Survivable networks: algorithms for diverse routing By Ramesh Bhandari
    Edition: illustrated Published by Springer, 1999 ISBN page 22

Weitere ähnliche Inhalte

Was ist angesagt?

Binary Tree in Data Structure
Binary Tree in Data StructureBinary Tree in Data Structure
Binary Tree in Data StructureMeghaj Mallick
 
Binary search tree operations
Binary search tree operationsBinary search tree operations
Binary search tree operationsKamran Zafar
 
Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search Treesagar yadav
 
Shortest path algorithm
Shortest path algorithmShortest path algorithm
Shortest path algorithmsana younas
 
Prim's Algorithm on minimum spanning tree
Prim's Algorithm on minimum spanning treePrim's Algorithm on minimum spanning tree
Prim's Algorithm on minimum spanning treeoneous
 
Dijkstra s algorithm
Dijkstra s algorithmDijkstra s algorithm
Dijkstra s algorithmmansab MIRZA
 
Hashing Technique In Data Structures
Hashing Technique In Data StructuresHashing Technique In Data Structures
Hashing Technique In Data StructuresSHAKOOR AB
 
Red black tree
Red black treeRed black tree
Red black treeRajendran
 
1.5 binary search tree
1.5 binary search tree1.5 binary search tree
1.5 binary search treeKrish_ver2
 
Data structure - Graph
Data structure - GraphData structure - Graph
Data structure - GraphMadhu Bala
 
A presentation on prim's and kruskal's algorithm
A presentation on prim's and kruskal's algorithmA presentation on prim's and kruskal's algorithm
A presentation on prim's and kruskal's algorithmGaurav Kolekar
 
Different Sorting tecniques in Data Structure
Different Sorting tecniques in Data StructureDifferent Sorting tecniques in Data Structure
Different Sorting tecniques in Data StructureTushar Gonawala
 
Prims and kruskal algorithms
Prims and kruskal algorithmsPrims and kruskal algorithms
Prims and kruskal algorithmsSaga Valsalan
 
Data Structures : hashing (1)
Data Structures : hashing (1)Data Structures : hashing (1)
Data Structures : hashing (1)Home
 
Graph in data structure
Graph in data structureGraph in data structure
Graph in data structureAbrish06
 

Was ist angesagt? (20)

Binary Tree in Data Structure
Binary Tree in Data StructureBinary Tree in Data Structure
Binary Tree in Data Structure
 
Binary search tree operations
Binary search tree operationsBinary search tree operations
Binary search tree operations
 
Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search Tree
 
Shortest path algorithm
Shortest path algorithmShortest path algorithm
Shortest path algorithm
 
Prim's Algorithm on minimum spanning tree
Prim's Algorithm on minimum spanning treePrim's Algorithm on minimum spanning tree
Prim's Algorithm on minimum spanning tree
 
Dijkstra s algorithm
Dijkstra s algorithmDijkstra s algorithm
Dijkstra s algorithm
 
Hashing Technique In Data Structures
Hashing Technique In Data StructuresHashing Technique In Data Structures
Hashing Technique In Data Structures
 
Red black tree
Red black treeRed black tree
Red black tree
 
1.5 binary search tree
1.5 binary search tree1.5 binary search tree
1.5 binary search tree
 
Data structure - Graph
Data structure - GraphData structure - Graph
Data structure - Graph
 
A presentation on prim's and kruskal's algorithm
A presentation on prim's and kruskal's algorithmA presentation on prim's and kruskal's algorithm
A presentation on prim's and kruskal's algorithm
 
BFS
BFSBFS
BFS
 
Different Sorting tecniques in Data Structure
Different Sorting tecniques in Data StructureDifferent Sorting tecniques in Data Structure
Different Sorting tecniques in Data Structure
 
Prims and kruskal algorithms
Prims and kruskal algorithmsPrims and kruskal algorithms
Prims and kruskal algorithms
 
Binary search tree(bst)
Binary search tree(bst)Binary search tree(bst)
Binary search tree(bst)
 
Hashing PPT
Hashing PPTHashing PPT
Hashing PPT
 
Shortest path algorithms
Shortest path algorithmsShortest path algorithms
Shortest path algorithms
 
Data Structures : hashing (1)
Data Structures : hashing (1)Data Structures : hashing (1)
Data Structures : hashing (1)
 
Heap sort
Heap sortHeap sort
Heap sort
 
Graph in data structure
Graph in data structureGraph in data structure
Graph in data structure
 

Andere mochten auch

Dijkstra’s algorithm
Dijkstra’s algorithmDijkstra’s algorithm
Dijkstra’s algorithmfaisal2204
 
Shortest Path Problem: Algoritma Dijkstra
Shortest Path Problem: Algoritma DijkstraShortest Path Problem: Algoritma Dijkstra
Shortest Path Problem: Algoritma DijkstraOnggo Wiryawan
 
Dijkstra's Algorithm
Dijkstra's AlgorithmDijkstra's Algorithm
Dijkstra's Algorithmguest862df4e
 
Dijkstra & flooding ppt(Routing algorithm)
Dijkstra & flooding ppt(Routing algorithm)Dijkstra & flooding ppt(Routing algorithm)
Dijkstra & flooding ppt(Routing algorithm)Anshul gour
 
All pairs shortest path algorithm
All pairs shortest path algorithmAll pairs shortest path algorithm
All pairs shortest path algorithmSrikrishnan Suresh
 
Networks dijkstra's algorithm- pgsr
Networks  dijkstra's algorithm- pgsrNetworks  dijkstra's algorithm- pgsr
Networks dijkstra's algorithm- pgsrLinawati Adiman
 
Application of Dijkstra Algorithm in Robot path planning
Application of Dijkstra Algorithm in Robot path planningApplication of Dijkstra Algorithm in Robot path planning
Application of Dijkstra Algorithm in Robot path planningDarling Jemima
 
Dijkstra algorithm
Dijkstra algorithmDijkstra algorithm
Dijkstra algorithmare you
 
Shortest path problem
Shortest path problemShortest path problem
Shortest path problemIfra Ilyas
 
Dijkstra's Algorithm - Colleen Young
Dijkstra's Algorithm  - Colleen YoungDijkstra's Algorithm  - Colleen Young
Dijkstra's Algorithm - Colleen YoungColleen Young
 
Dijkastra’s algorithm
Dijkastra’s algorithmDijkastra’s algorithm
Dijkastra’s algorithmPulkit Goel
 
Basics of data structure
Basics of data structureBasics of data structure
Basics of data structureRajendran
 
Face recogniton based digital signature for email encryption and signing
Face recogniton based digital signature for email encryption and signingFace recogniton based digital signature for email encryption and signing
Face recogniton based digital signature for email encryption and signingChimi Wangmo
 
Walking ...
Walking ...Walking ...
Walking ...vlastos
 
A neural ada boost based facial expression recogniton System
A neural ada boost based facial expression recogniton SystemA neural ada boost based facial expression recogniton System
A neural ada boost based facial expression recogniton SystemInternational Islamic University
 
Lewis Dijkstra, DG Regional Policy
Lewis Dijkstra, DG Regional PolicyLewis Dijkstra, DG Regional Policy
Lewis Dijkstra, DG Regional Policyplan4all
 

Andere mochten auch (20)

Dijkstra’s algorithm
Dijkstra’s algorithmDijkstra’s algorithm
Dijkstra’s algorithm
 
Shortest Path Problem: Algoritma Dijkstra
Shortest Path Problem: Algoritma DijkstraShortest Path Problem: Algoritma Dijkstra
Shortest Path Problem: Algoritma Dijkstra
 
Dijkstra's Algorithm
Dijkstra's AlgorithmDijkstra's Algorithm
Dijkstra's Algorithm
 
Dijkstra & flooding ppt(Routing algorithm)
Dijkstra & flooding ppt(Routing algorithm)Dijkstra & flooding ppt(Routing algorithm)
Dijkstra & flooding ppt(Routing algorithm)
 
All pairs shortest path algorithm
All pairs shortest path algorithmAll pairs shortest path algorithm
All pairs shortest path algorithm
 
Dijkstra's Algorithm
Dijkstra's Algorithm Dijkstra's Algorithm
Dijkstra's Algorithm
 
Networks dijkstra's algorithm- pgsr
Networks  dijkstra's algorithm- pgsrNetworks  dijkstra's algorithm- pgsr
Networks dijkstra's algorithm- pgsr
 
Application of Dijkstra Algorithm in Robot path planning
Application of Dijkstra Algorithm in Robot path planningApplication of Dijkstra Algorithm in Robot path planning
Application of Dijkstra Algorithm in Robot path planning
 
Dijkstra algorithm
Dijkstra algorithmDijkstra algorithm
Dijkstra algorithm
 
Shortest path problem
Shortest path problemShortest path problem
Shortest path problem
 
Dijkstra's Algorithm - Colleen Young
Dijkstra's Algorithm  - Colleen YoungDijkstra's Algorithm  - Colleen Young
Dijkstra's Algorithm - Colleen Young
 
Dijkastra’s algorithm
Dijkastra’s algorithmDijkastra’s algorithm
Dijkastra’s algorithm
 
Basics of data structure
Basics of data structureBasics of data structure
Basics of data structure
 
Face recogniton based digital signature for email encryption and signing
Face recogniton based digital signature for email encryption and signingFace recogniton based digital signature for email encryption and signing
Face recogniton based digital signature for email encryption and signing
 
Graph & Heap in Data Structure (Basic Information)
Graph & Heap in Data Structure (Basic Information)Graph & Heap in Data Structure (Basic Information)
Graph & Heap in Data Structure (Basic Information)
 
Walking ...
Walking ...Walking ...
Walking ...
 
A neural ada boost based facial expression recogniton System
A neural ada boost based facial expression recogniton SystemA neural ada boost based facial expression recogniton System
A neural ada boost based facial expression recogniton System
 
CSE240 Doubly Linked Lists
CSE240 Doubly Linked ListsCSE240 Doubly Linked Lists
CSE240 Doubly Linked Lists
 
Lewis Dijkstra, DG Regional Policy
Lewis Dijkstra, DG Regional PolicyLewis Dijkstra, DG Regional Policy
Lewis Dijkstra, DG Regional Policy
 
Lecture set 5
Lecture set 5Lecture set 5
Lecture set 5
 

Ähnlich wie Dijkstra

Lecture 5b graphs and hashing
Lecture 5b graphs and hashingLecture 5b graphs and hashing
Lecture 5b graphs and hashingVictor Palmar
 
Graph terminology and algorithm and tree.pptx
Graph terminology and algorithm and tree.pptxGraph terminology and algorithm and tree.pptx
Graph terminology and algorithm and tree.pptxasimshahzad8611
 
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.pptWahyuAde4
 
Lecture 14 data structures and algorithms
Lecture 14 data structures and algorithmsLecture 14 data structures and algorithms
Lecture 14 data structures and algorithmsAakash deep Singhal
 
Chap10 slides
Chap10 slidesChap10 slides
Chap10 slidesHJ DS
 
Graph ASS DBATU.pptx
Graph ASS DBATU.pptxGraph ASS DBATU.pptx
Graph ASS DBATU.pptxARVIND SARDAR
 
Graph_data_structure_information_engineering.pptx
Graph_data_structure_information_engineering.pptxGraph_data_structure_information_engineering.pptx
Graph_data_structure_information_engineering.pptxsahilpawar2426
 
Lecture 2.3.1 Graph.pptx
Lecture 2.3.1 Graph.pptxLecture 2.3.1 Graph.pptx
Lecture 2.3.1 Graph.pptxking779879
 
Graph Analyses with Python and NetworkX
Graph Analyses with Python and NetworkXGraph Analyses with Python and NetworkX
Graph Analyses with Python and NetworkXBenjamin Bengfort
 
Graph theory concepts complex networks presents-rouhollah nabati
Graph theory concepts   complex networks presents-rouhollah nabatiGraph theory concepts   complex networks presents-rouhollah nabati
Graph theory concepts complex networks presents-rouhollah nabatinabati
 
Graph Analytics - From the Whiteboard to Your Toolbox - Sam Lerma
Graph Analytics - From the Whiteboard to Your Toolbox - Sam LermaGraph Analytics - From the Whiteboard to Your Toolbox - Sam Lerma
Graph Analytics - From the Whiteboard to Your Toolbox - Sam LermaPyData
 

Ähnlich wie Dijkstra (20)

Lecture 5b graphs and hashing
Lecture 5b graphs and hashingLecture 5b graphs and hashing
Lecture 5b graphs and hashing
 
Graph terminology and algorithm and tree.pptx
Graph terminology and algorithm and tree.pptxGraph terminology and algorithm and tree.pptx
Graph terminology and algorithm and tree.pptx
 
Algorithms Design Exam Help
Algorithms Design Exam HelpAlgorithms Design Exam Help
Algorithms Design Exam Help
 
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
 
Lecture 14 data structures and algorithms
Lecture 14 data structures and algorithmsLecture 14 data structures and algorithms
Lecture 14 data structures and algorithms
 
Chap10 slides
Chap10 slidesChap10 slides
Chap10 slides
 
Weighted graphs
Weighted graphsWeighted graphs
Weighted graphs
 
graph ASS (1).ppt
graph ASS (1).pptgraph ASS (1).ppt
graph ASS (1).ppt
 
Chap10 slides
Chap10 slidesChap10 slides
Chap10 slides
 
1535 graph algorithms
1535 graph algorithms1535 graph algorithms
1535 graph algorithms
 
Algorithms Design Assignment Help
Algorithms Design Assignment HelpAlgorithms Design Assignment Help
Algorithms Design Assignment Help
 
Graph ASS DBATU.pptx
Graph ASS DBATU.pptxGraph ASS DBATU.pptx
Graph ASS DBATU.pptx
 
Graph_data_structure_information_engineering.pptx
Graph_data_structure_information_engineering.pptxGraph_data_structure_information_engineering.pptx
Graph_data_structure_information_engineering.pptx
 
Lecture 2.3.1 Graph.pptx
Lecture 2.3.1 Graph.pptxLecture 2.3.1 Graph.pptx
Lecture 2.3.1 Graph.pptx
 
Cnetwork
CnetworkCnetwork
Cnetwork
 
10.graph
10.graph10.graph
10.graph
 
Graph Analyses with Python and NetworkX
Graph Analyses with Python and NetworkXGraph Analyses with Python and NetworkX
Graph Analyses with Python and NetworkX
 
Twopi.1
Twopi.1Twopi.1
Twopi.1
 
Graph theory concepts complex networks presents-rouhollah nabati
Graph theory concepts   complex networks presents-rouhollah nabatiGraph theory concepts   complex networks presents-rouhollah nabati
Graph theory concepts complex networks presents-rouhollah nabati
 
Graph Analytics - From the Whiteboard to Your Toolbox - Sam Lerma
Graph Analytics - From the Whiteboard to Your Toolbox - Sam LermaGraph Analytics - From the Whiteboard to Your Toolbox - Sam Lerma
Graph Analytics - From the Whiteboard to Your Toolbox - Sam Lerma
 

Kürzlich hochgeladen

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 

Kürzlich hochgeladen (20)

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 

Dijkstra

  • 1. Presentation on prolog : Dijkstra’s Algorithm
  • 2. A graph is defined as a set of nodes and a set of edges, where each edge is a pair of nodes.
  • 3. There are several ways to represent graphs in Prolog.  One method is to represent each edge separately as one clause (fact). • edge(1, 5). edge(1, 7). edge(2, 1). edge(2, 7). edge(3, 1). edge(3, 6). edge(4, 3). edge(4, 5). edge(5, 8). edge(6, 4). edge(6, 5). edge(7, 5). edge(8, 6). edge(8, 7). We call this edge-clause form W
  • 4.  Another method is to represent the whole graph as one data object. According to the definition of the graph as a pair of two sets (nodes and edges).  EXAMPLE :  graph([b,c,d,f,g,h,k],[e(b,c),e(b,f),e(c,f),e(f,k),e(g,h)]) .  We call this graph-term form. Note, that the lists are kept sorted, they are really sets, without duplicated elements. Each edge appears only once in the edge list.  The graph-term form is a default representation
  • 5.  A third representation method is to associate with each node the set of nodes that are adjacent to that node .  EXAMPLE: [n(b,[c,f]), n(c,[b,f]), n(d,[]), n(f,[b,c,k]), .........]. 
  • 6. Directed graphs  These are represented by ordered pairs  To represent a directed graph, the forms discussed above are slightly modified. The example graph is represented as follows:  When the edges are directed we call them arcs Arc-clause form  arc(s,u). arc(u,r). Graph-term form  digraph([r,s,t,u,v],[a(s,r),a(s,u),a(u,r),a(u,s),a(v,u)]) Adjacency-list form  [n(r,[]),n(s,[r,u]),n(t,[]),n(u,[r]),n(v,[u])]
  • 7. Dijkstra  Dijkstra's algorithm, introduced by the dutch computer scientist , is a graph searching algorithm.  Dijkstra’s algorithm is used to solve the problems of finding the shortest path between edge - weighted graphs in which all the weights are non-negative.
  • 8. Basic features of Dijkstra's algorithm  For a given source vertices it finds the lowest cost(i.e. The shortest path) for every other vertices .  It can also be used to find the lowest cost for a particular destination by the stopping the algorithm in between.  For example:- If the vertices represents the cities and the edge path cost represents the distance between pair cities then dijkstra’s can be used to find the shortest route between one city and all other.
  • 9. An example of Dijkstra’s Algorithm
  • 10. Dijkstra’s Algorithm can be applied to network routing, as it can be used to find the shortest path from any source computer to any other computer in the network .
  • 11. Basic steps towards the algorithm  The algorithm begins by initializing any vertex in the graph (vertex A, for example) a permanent label with the value of 0, and all other vertices a temporary label with the value of 0.
  • 12. Basic steps towards  The algorithm then proceeds to select the least cost edge connecting a vertex with a permanent label (currently vertex A) to a vertex with a temporary label (vertex B, for example). Vertex B's label is then updated from a temporary to a permanent label. Vertex B's value is then determined by the addition of the cost of the edge with vertex A's value
  • 13. Basic steps towards  The next step is to find the next least cost edge extending to a vertex with a temporary label from either vertex A or vertex B (vertex C, for example), change vertex C's label to permanent, and determine its distance to vertex A.
  • 14. Basic steps towards This process is repeated until the labels of all vertices in the graph are permanent.
  • 15. Start Identify source node and destination node as V1 and V2 Set V1 as T-node Set T-node’s label to “permanent” and update neighbor's status record set Identify the tentative node linked to V1 that has the lowest weight and set it as T-node Is T-Node is V2? END Based on information in status record set, do these until u reach V1. The string of link represents the best route
  • 16.
  • 17. dijkstra(Graph,MinDist,[],MinDist). dijkstra(Graph,Closed,Open,MinDist):- min(Open,V-D,ReducedOpen), adjacent(Graph,V,AdjacentNodes), diff(AdjacentNodes,Closed,PrunedNodes), addDist(PrunedNodes,D,UpdatedPrunedNodes), nodeMerge(UpdatedPrunedNodes,ReducedOpen,NextOpen), dijkstra(Graph,[V-D|Closed],NextOpen,MinDist).
  • 18. Rules which are used above in the pesudo code  min(L,Min,Rest):- The method min above takes a list L and puts the smallest value in the MIN with the smallest value in L and Rest with a list containing all values in L excluding Min.  adjacent(Graph,Node,Adj) which is true if Adj is a list of all nodes reachable from the node Node in one hop in Graph. Node is of the form of a single graph vertex label (i.e. the minimum cost is not included), Adj should be a list of node-cost pairs. For example, given the query adjacent([a-b-1,a-c-2,b-a-4,b- c-1],a,A) Prolog should return A = [b-1,c-2]
  • 19. Rules which are used above in the pesudo code  diff(L,M,N) takes a list L and a list M and unifies N with a list containing all items in L which are not in M. The list L is assumed to contain no duplicate elements.  addDist(Nodes, D, NewNodes) which is true if NewNodes is a list containing all the nodes in Nodes with their edge cost incremented by D.
  • 20. Rules which are used above in the pesudo code  nodeMerge(A,B,C) which merge lists A and B together and unifies the result in C. Lists A, B and C contain no duplicate elements: i.e. within the each list there is no pair of nodes V1,V2 such that V1=V2.
  • 21. In today’s world, networking plays an important role in communication between autonomous computers. For this many hardware devices and software algorithms have been designed. So far, the traditional system used for the communication were the hub networking system and many other hardware applications present in the market, but as they operate on electricity, it may lead to the failure of device due to some malfunctioning in the hardware circuitry. Dijkstra Algorithm provides easy understandability and hence its chances of failure is negligible.
  • 22. References http://students.ceid.upatras.gr/~papagel/project/kef5_7_1.htm  http://www.animal.ahrgr.de/showAnimationDetails.php3?lang=en&anim= 16  http://www.cs.sunysb.edu/~skiena/combinatorica/animations/dijkstra.ht ml  http://www.ibiblio.org/links/devmodules/graph_networking/xhtml/page13 .xml  Survivable networks: algorithms for diverse routing By Ramesh Bhandari Edition: illustrated Published by Springer, 1999 ISBN page 22