Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat :Added Various Graph Algorithms: Hamiltonian Cycle, Kahn’s Algorithm, Kosaraju’s, Kruskal, Prim’s MST, Welsh-Powell, and More #2929

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tiwariar7
Copy link

No description provided.

…Kosaraju’s, Kruskal, Prim’s MST, Welsh-Powell, and More

This update introduces several important graph algorithms, each solving distinct problems within graph theory. The added algorithms are:

Hamiltonian Cycle: Finds a cycle in a graph that visits every vertex exactly once.
Kahn's Algorithm: Implements topological sorting using Kahn’s approach, which handles directed acyclic graphs (DAGs).
Kosaraju's Algorithm: Efficiently finds all strongly connected components in a directed graph.
Kruskal's Algorithm: A greedy algorithm for finding the Minimum Spanning Tree (MST) of a graph by adding edges in increasing weight order.
Prim's MST: Another MST algorithm that grows a tree from a starting vertex, always picking the smallest connecting edge.
Welsh-Powell: Implements graph coloring using the Welsh-Powell algorithm, which minimizes the number of colors required to color the graph.
Bellman-Ford Algorithm: Computes shortest paths from a single source vertex to all other vertices, handling negative weight edges.
Connected Component: Finds all connected components in an undirected graph.
Cycle Detection: Detects and prints all cycles in a directed graph using DFS.
Floyd-Warshall Algorithm: Solves the all-pairs shortest path problem using dynamic programming.
Matrix Graphs: Handles various graph operations using matrix representations, such as adjacency matrices.
Tarjan’s Algorithm: Finds all strongly connected components using DFS with linear time complexity.
These algorithms are crucial for solving a wide variety of graph-related problems, from cycle detection and shortest paths to graph coloring and strongly connected components.

Files Updated:

HamiltonianCycle.java
KahnsAlgorithm.java
Kosaraju.java
Kruskal.java
PrimMST.java
WelshPowell.java
BellmanFord.java
ConnectedComponent.java
Cycles.java
FloydWarshall.java
MatrixGraphs.java
TarjansAlgorithm.java
This pull request significantly enhances the repository's graph algorithm collection, making it a comprehensive toolkit for graph theory and analysis.
Added Various Graph Algorithms: Hamiltonian Cycle, Kahn’s Algorithm, …
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant