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

This is a C++ Program to find the connected components of the undirected graph. This can be done using depth first search algorithm. Here is source code of the C++ Program to Check Whether it is Weakly Connected or Strongly Connected for a Directed Graph. The C++ program is successfully compiled and run on a … Read more

advertisement

C++ Program to Find Shortest Path in a DAG using Topological Sorting

This is a C++ Program to find shortest path for DAG using topological sorting. For a general weighted graph, we can calculate single source shortest distances in O(VE) time using Bellman–Ford Algorithm. For a graph with no negative weights, we can do better and calculate single source shortest distances in O(E + VLogV) time using … Read more

advertisement

C++ Program to Remove the Edges in a Cyclic Graph such that its Linear Extension can be Found

This is a C++ Program to find feedback arc set. This is the set which contains edges which when removed from the graph, graph becomes directed acyclic graph. Here is source code of the C++ Program to Remove the Edges in a Given Cyclic Graph such that its Linear Extension can be Found. The C++ … Read more

advertisement

C++ Program to Check Whether an Undirected Graph Contains a Eulerian Path

This is a C++ Program to check whether an undirected graph contains Eulerian Path. The criteran Euler suggested, 1. If graph has no odd degree vertex, there is at least one Eulerian Circuit. 2. If graph as two vertices with odd degree, there is no Eulerian Circuit but at least one Eulerian Path. 3. If … Read more

advertisement

C++ Program to Check Whether a Directed Graph Contains a Eulerian Path

This is a C++ Program to check whether graph contains Eulerian Path. The criteran Euler suggested, 1. If graph has no odd degree vertex, there is at least one Eulerian Circuit. 2. If graph as two vertices with odd degree, there is no Eulerian Circuit but at least one Eulerian Path. 3. If graph has … Read more

advertisement

C++ Program to Check Whether an Undirected Graph Contains a Eulerian Cycle

This is a C++ Program to check whether an undirected graph contains Eulerian Cycle. The criteran Euler suggested, 1. If graph has no odd degree vertex, there is at least one Eulerian Circuit. 2. If graph as two vertices with odd degree, there is no Eulerian Circuit but at least one Eulerian Path. 3. If … Read more

advertisement

C++ Program to Check Whether a Directed Graph Contains a Eulerian Cycle

This is a C++ Program to check whether graph contains Eulerian Cycle. The criteran Euler suggested, 1. If graph has no odd degree vertex, there is at least one Eulerian Circuit. 2. If graph as two vertices with odd degree, there is no Eulerian Circuit but at least one Eulerian Path. 3. If graph has … Read more

advertisement

C++ Program to Check if Path Exists in a Graph

This is a C++ Program to check and find if the path between two nodes exists. By running DFS on given graph we can find out whether path exists between two nodes. Here is source code of the C++ Program to Find Path Between Two Nodes in a Graph. The C++ program is successfully compiled … Read more

advertisement

C++ Program to Implement Johnson’s Algorithm

This is a C++ Program to implement Johnson’s Algorithm. Johnson’s algorithm helps to find shortest path between given source and destination nodes. Here is source code of the C++ Program to Implement Johnson’s Algorithm. The C++ program is successfully compiled and run on a Linux system. The program output is also shown below. #include<iostream>#include<conio.h> using namespace … Read more

advertisement

C++ Program to Apply the Kruskal’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. Kruskal’s algorithm is a greedy algorithm in graph theory that finds a minimum spanning tree for a connected weighted graph. This means it finds a subset of the edges that forms a tree that includes every vertex, where the total … 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.