C++ Program to Apply the Prim’s Algorithm to Find the Minimum Spanning Tree of a Graph

This is a C++ Program to find the minimum spanning tree of the given graph using Prims algorihtm. In computer science, Prim’s algorithm is a greedy algorithm that finds a minimum spanning tree for a connected weighted undirected graph. This means it finds a subset of the edges that forms a tree that includes every … Read more

advertisement

C++ Program to Find the Transitive Closure of a Graph using Warshall’s Algorithm

This is a C++ Program find the transitive closure using Warshall’s algorithm. In mathematics, the transitive closure of a binary relation R on a set X is the transitive relation R+ on set X such that R+ contains R and R+ is minimal (Lidl and Pilz 1998:337). If the binary relation itself is transitive, then … Read more

advertisement

C++ Program to Check if a Graph is Strongly Connected or Not

This is a C++ Program to check whether given graph is strongly connected or not. If there exists multiple strongly connected component, graph is not strongly connected, it is otherwise. Here is source code of the C++ Program to Check Whether a Graph is Strongly Connected or Not. The C++ program is successfully compiled and … Read more

advertisement

C++ Program to Implement Dijkstra’s Algorithm using Queue

This is a C++ Program to implement Dijkstra’s Shortest path algorithm using Queue. Here is source code of the C++ Program to Implement Dijkstra’s Algorithm Using Queue. The C++ program is successfully compiled and run on a Linux system. The program output is also shown below. #include <cstdio>#include <queue>#include <vector>#include <iostream> using namespace std; #define MAX 100001#define … Read more

advertisement

C++ Program to Check the Connectivity of Directed Graph Using BFS

This is a C++ Program to check the connectivity of directed graph using BFS. Here is source code of the C++ Program to Check the Connectivity of Directed Graph Using BFS. The C++ program is successfully compiled and run on a Linux system. The program output is also shown below. /* * C++ Program to Check … Read more

advertisement

C++ Program to Find the Connected Components in an UnDirected Graph

This is a C++ Program to find the connected components of the undirected graph. This can be done using depth first search Here is source code of the C++ Program to Find the Connected Components of an UnDirected Graph. The C++ program is successfully compiled and run on a Linux system. The program output is … Read more

advertisement

C++ Program to Find the Shortest Path using Bellman Ford Algorithm

This is a C++ Program to find the shortest path algorithm using Bellman-Ford algorithm. This algorithm also entertains negative edge weights. Here is source code of the C++ Program to Use the Bellman-Ford Algorithm to Find the Shortest Path Between Two Vertices Assuming that Negative Size Edges Exist in the Graph. The C++ program is … Read more

advertisement

C++ Program to Find Minimum Spanning Tree using Kruskal’s Algorithm

This C++ program displays the minimum spanning tree formed by implementation of Kruskal’s algorithm. Here is the source code of the C++ program to implement Kruskal’s algorithm. This C++ program is successfully compiled and run on DevCpp, a C++ compiler. The program output is given below. /* * C++ Program to Find MST(Minimum Spanning Tree) using … Read more

advertisement

C++ Program to Implement Edmonds Karp Algorithm

This C++ program implements the Edmonds_Karp Algorithm which is used to compute the maximum flow between the sink and source vertex. It is the same as the Ford-Fulkersson Algorithm except that it uses breadth first search to reduce time complexity. Here is the source code of the C++ program to display the maximum flow by … Read more

advertisement

C++ Program to Find Maximum Number of Edge Disjoint Paths

This C++ program displays the maximum number of edge disjoint paths present between two vertices. Maximum number of edge disjoint paths refers to the maximum flow or shortest subset path between two vertices. Here is the source code of the C++ program to display the number of paths present between two given vertices on being … Read more

advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.