C Programming Examples on Hard Graph Problems & Algorithms

This section covers C Programming Examples on Hard Graph Problems & Algorithms. Every example program includes the description of the program, C code as well as output of the program. Here is the listing of C programming examples:

1. C Programming examples on “Clique”

This section contains a C programs to find the maximum size clique and largest clique in a planar graphs, finds the size of largest independent set in a binary and n-ary tree. The other programs in this section finds the clique and compares it with the size of the graph and performs graph coloring.

C Program to Find the Maximum Size Clique in a Graph
C Program to Find a Clique by Using the Technique of the Most Dense Subgraph
C Program to Find the Largest clique in a Planar Graph
C Program to Solve the Decision Problem of Testing Whether a Graph Contains a Clique Larger than a Given Size
C Program to Find a Maximum Weight Clique in a Weighted Graph
C Program to Find All the Cliques of a Given Size k
C Program to Find the Largest Independent Set in a Graph by Complements and Find the Clique of this Graph
C Program to Find Independent Sets in a Graph by Graph Coloring
C Program to Find the Maximum Independent Set of a Tree in Linear Time
C Program to Find Size of the Largest Independent Set(LIS) in a Given a Binary Tree
C Program to Find Size of the Largest Independent Set(LIS) in a Given an N-ary Tree

2. C Programming examples on “Vertex Cover”

Vertex cover of an undirected graph is a subset of its vertices such that for every edge (u, v) of the graph, either ‘u’ or ‘v’ is in vertex cover. The C programs in this section to check whether vertex cover size k exists or not, implements heuristic to find the vertex cover in a graph and also solves dominating set problems.

advertisement

C Program to Implement a Heuristic to Find the Vertex Cover of a Graph
C Program to Solve the Dominating Set Problem
C Program to Check Whether a Vertex Cover of Size k Exists

3. C Programming examples on “Traveling Salesman Problem”

Held-Karp Algorithm solves the Traveling Salesman Problem using dynamic programming with memoization. Nearest Neighbour Algorithm is the simplest algorithm to solve TSP. Travelling Salesman Problem computes the minimum cost required to visit all the nodes by traversing across the edges only once. This Section Contains C programs to solve TSP using minimum spanning trees, incremental insertion method and graphs. The other programs in this section to finds the k-optimal tour for TSP, held-karp algorithm, implements branch method, bound method and nearest neighbour algorithm implementation.

C Program to Solve Travelling Salesman Problem for Unweighted Graph
C Program to Implement Branch and Bound Method to Perform a Combinatorial Search
C Program to Solve TSP Using Minimum Spanning Trees
C Program to Solve TSP Using Incremental Insertion Method
C Program to Find a k-Optimal Tour for TSP
C Program to Implement Held-Karp Algorithm
C Program to Implement Nearest Neighbour Algorithm

4. C Programming examples on “Hamiltonian Cycle”

Hamiltonian cycle in a graph is a special case of the traveling salesman problem. This section contains C programs to find the hamiltonian cycle in a graph and checks whether the given graph is hamiltonian or not. It also converts hamiltonian cycle into path.

C Program to Find Hamiltonian Cycle in an UnWeighted Graph
C Program to Find the Longest Path in a DAG
C Program to Check if a Given Graph must Contain Hamiltonian Cycle or Not
C Program to Convert Hamiltonian Cycle into Path
C Program to Check Whether a Hamiltonian Cycle or Path Exists in a Given Graph

5. C Programming examples on “Graph Partition”

This section contains C programs to find the minimum edges and maximum cut in a graph, it also performs spectral partitioning of graph and tree partition using DFS.

advertisement

C Program to Find Minimum Number of Edges to Cut to make the Graph Disconnected
C Program to Partition a Tree from a Given Element using DFS
C Program to Find the Maximum Cut in a Graph
C Program to Perform Spectral Partitioning of a Graph

6. C Programming examples on “Vertex Coloring”

Bipartite graph is a set of graph vertices decomposed into two disjoint sets such that no two graph vertices within the same set are adjacent. The C programs in this section performs greedy coloring, graph and edge coloring on bipartite graphs and checks whether given graph is bipartite or not and implements 4-color problem, it also performs vertex coloring graph by using color interchange method.

C Program to Perform Graph Coloring on Bipartite Graphs
C Program to Check if a Given Graph is Bipartite
C Program to Perform Edge Coloring of a Graph
C Program to Use Color Interchange Method to Perform Vertex Coloring of Graph
C Program to Demonstrate the Implementation of 4-Color Problem
C Program to Perform Greedy Coloring

7. C Programming examples on “Edge Coloring”

The C programs in this section performs edge coloring on graphs, finds the chromatic index and arboricity of a graph, implements vizing’s theorem and solves open shop scheduling problems.

C Program to Implement the Vizing’s Theorem
C Program to Find Chromatic Index of Cyclic Graphs
C Program to Perform Edge Coloring on Complete Graph
C Program to Perform Edge Coloring to the Line Graph of an Input Graph
C Program to Find the Arboricity of a Graph
C Program to Solve the Open Shop Scheduling Problem

8. C Programming examples on “Steiner Tree”

Steiner Tree may contain some vertices which are not in given subset but are used to connect the vertices of subset. This section contains C programs to find the steiner tree and its size in a given graph. The other programs explain how to apply heuristic to find the shortest path in steiner tree.

advertisement

C Program to Find the Steiner Tree of a Given Graph
C Program to Apply Heuristic Based on Shortest Path to Find Steiner Tree
C Program to Check if a Steiner Tree Size k Exists for a Graph

9. C Programming examples on “Feedback Edge/Vertex Set”

Feedback edge in a graph is the set which contains edges which when removed from the graph, graph becomes directed acyclic graph. Directed acyclic graph is a directed graph with no directed cycles. This section contains C programs to find the good feedback edge and vertex set in a graph and checks whether graph is DAG.

C Program to Check Whether Graph is DAG
C Program to Find a Good Feedback Edge Set in a Graph
C Program to Find a Good Feedback Vertex Set