## C++ Program to Check Whether it is Weakly Connected or Strongly Connected for a Directed Graph

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

## C++ Program to Print only Odd Numbered Levels of a Tree

This is a C++ Program to print odd levels of the tree. There are basically two functions in this method. One is to print all nodes at a given level (printGivenLevel), and other is to print level order traversal of the tree (printLevelorder). printLevelorder makes use of printGivenLevel to print nodes at all levels one … Read more

## C++ Program to Solve a Matching Problem for a Given Specific Case

This is a C++ Program to solve a matching problem. Given N men and N women, where each person has ranked all members of the opposite gender in order of preference, marry the men and women together such that there are no two people of opposite gender who would both rather have each other than … Read more

## C++ Program to Implement Shortest Path Algorithm for 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

## C++ Program to Create a Random Linear Extension for a DAG

This is a C++ Program to find random linear extension of DAG. Linear extension is another term for finding topological sort of a graph. Here is source code of the C++ Program to Create a Random Linear Extension for a DAG. The C++ program is successfully compiled and run on a Linux system. The program … Read more

## C++ Program to Solve a Matching Problem for a Given Specific Case2

This is a C++ Program to solve a matching problem. Given N men and N women, where each person has ranked all members of the opposite gender in order of preference, marry the men and women together such that there are no two people of opposite gender who would both rather have each other than … Read more

## C++ Program to Solve a Matching Problem for a Given Specific Case3

This is a C++ Program to solve a matching problem. Given N men and N women, where each person has ranked all members of the opposite sex in order of preference, marry the men and women together such that there are no two people of opposite sex who would both rather have each other than … Read more

## C++ Program to Remove the Edges in a Given 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

## 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 