Skip to content

Mohammad533643/Warshall-Algorithm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Warshall Algorithm

License: MIT Repo size

Warshall algorithm is used to determine all the existing paths between different vertices of a graph.
This program is mostly scientific in nature and suitable for students, and it may not be optimized enough in terms of time complexity, etc.

Example

We have a graph with vertices A, B, C and edges AB, BC. We give the inputs to the program according to the code.

Input

    Enter your set :A,B,C
    Enter the size of Relation : 2
    Enter Relation 1: AB
    Enter Relation 2: BC

Output

w0 =  {('B', 'C'), ('A', 'B')}

w0:
[0, 1, 0]
[0, 0, 1]
[0, 0, 0]

w1:
[0, 1, 0]
[0, 0, 1]
[0, 0, 0]

w1 = {('B', 'C'), ('A', 'B')}

w2:
[0, 1, 1]
[0, 0, 1]
[0, 0, 0]

w2 = {('B', 'C'), ('A', 'C'), ('A', 'B')}

w3:
[0, 1, 1]
[0, 0, 1]
[0, 0, 0]

w3 = {('B', 'C'), ('A', 'C'), ('A', 'B')}

This indicates that, apart from the initial edges, there can be an edge from A to C.

About

This algorithm helps students to solve their mathematics questions, especially disceete questions.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages