# C++ Programming Code Examples

## C++ > Computer Graphics Code Examples

This is a C++ Program code to check whether graph is DAG. In mathematics and computer science, a directed acyclic graph, is a directed graph with no directed cycles. It is formed by

Program to find the connected components of the "Undirected Graph". This can be done using depth first search algorithm. Fills stack with vertices (in increasing order of finishing

A "Recursive Function" to print 'DFS' starting from v. Returns reverse ('or transpose') of this graph. Add edge to connect v and w. Check if Graph is Connected and display 'The Graph is

C++ Program to find the cross product of two vectors. In mathematics, the cross product or vector product is a "Binary Operation" on two vectors in three-dimensional space. It results

C++ Language code to compute the area of a triangle using determinants. The 'plus/minus' in this case is meant to take whichever sign is needed so the 'answer is positive'. Do not say

Program to finds the volume of tetrahedron. Call the four vertices of the tetrahedron (a, b, c), (d, e, f), (g, h, i), and (p, q, r). Now create a 4-by-4 matrix in which the coordinate triples

Program, using recursion, evaluates a Prefix Expression in an "Expression Tree". A binary expression tree is a specific application of a 'binary tree' to evaluate certain expressions.

C++ Program to construct an Expression tree for an "Infix Expression". A binary expression tree is a specific application of a "binary tree" to evaluate certain expressions. These trees

Finding the transitive closure using Warshall's Algorithm. 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

In computer science, a "self-balancing" binary search tree is any "node-based" binary search tree that automatically keeps its height small in the face of arbitrary item insertions & item

This algorithm randomly assigns a number of vertexes and edges of the graph. It connects vertexes randomly & generates cyclic, acyclic or disconnected undirected graphs. Generate

"Linear extension" is another term for finding topological sort of a graph. A C++ program to print topological sorting of a DAG. Pointer to an array containing adjacency listsList. Graph

This algorithm represents a given graph using 'Adjacency List'. This method of representing graphs isn't efficient. The time complexity of this algorithm is O(v*e). Print the 'adjacency'

Takes the input of the 'number of vertex'. For each pair of vertex ask user whether they are connected or not. Print the adjacency matrix. A function to print the adjacency matrix. And

This algorithm takes the input of the number of 'vertex and edges'. Then it takes the input of connected vertex pairs. Print the incidence list representation of the graph. And for each

C++ Program should have two functions one which takes radius as parameter and second takes diameter as parameter. If enters wrong option then tell users its 'valid selection' and

Algorithm finds the "Chromatic Index" of the given cyclic graph. It takes the input of vertex pairs for the given number of edges. Assigns a 'color to edges' without assigning the same

Code finds 'largest independent' set by graph coloring. In graph theory, an independent set or stable set is a set of vertices in a graph, no two of which are adjacent. That is, it is a set I

C++ code displays the Gauss Jordan method of computing inverse of a matrix. it proceeds with row by row "reduction of matrix" to unit matrix column-wise. First enter the order of

Get minimum of two numbers in hist[]. Get the 'middle index' from corner indexes. Get the index of minimum value in a given range of indexes. Then returns 'index' of minimum

This C++ program, using recursion, displays the "Lowest Common Ancestor" in a binary search tree. lowest common ancestor is one in which the lowest common parent node of

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

Program to find minimum number of edges to cut to make the 'graph disconnected'. An edge in an undirected connected graph is a bridge if removing it disconnects the graph.

This C++ program sample depicts the Prim's Algorithm which finds the minimal spanning tree(tree consisting of the minimum weights of edges connecting any 2 vertices) in graph.

Program to find largest independent set in a binary tree. In graph theory, an independent set or stable set is a set of vertices in a graph, no two of which are 'adjacent'. That is, it is a

This is a C++ program "Displays the Nodes" which are strongly connected to each other. Strongly connected subgraphs are those in which a path is available from any node of

Program to find the connected components of the "undirected graph". This can be done using depth first search. Implementation of "Kosaraju's algorithm" to print all SCCs. Fills

C++ Program to find edge connectivity of a graph. An edge in an undirected connected graph is a bridge if removing it disconnects the graph. For a "disconnected undirected"

This is a C++ Program to find the "cliques" of size k in a a graph. An "undirected graph" is formed by a finite set of vertices and a set of unordered pairs of vertices, which are called

Program to find longest path in DAG. Given a weighted directed acyclic graph and a source vertex s in it, find the longest distances from s to all other vertices in the given graph. Create

Page 1 Page 2 Page 3 Page 4 Page 5 Page 6