Given an adjacency list representation of a Graph, the task is to convert the given Adjacency List to Adjacency Matrix representation. Examples: Input: adjList[] =… Read More

# Tag Archives: graph-basics

Prerequisites: Graph and its representationsGiven an adjacency matrix g[][] of a graph consisting of N vertices, the task is to modify the matrix after insertion… Read More

Prerequisites: Graph Data Structure And Algorithms A Graph is a non-linear data structure consisting of nodes and edges. The nodes are sometimes also referred to… Read More

Parenthesis Theorem is used in DFS of graph. It states that the descendants in a depth-first-search tree have an interesting property. If v is a… Read More

Given a graph with n nodes and m edges. Find the maximum possible number of nodes which are not part of any edge (m will… Read More

A Graph is a non-linear data structure consisting of nodes and edges. The nodes are sometimes also referred to as vertices and the edges are… Read More

Transpose of a directed graph G is another directed graph on the same set of vertices with all of the edges reversed compared to the… Read More

Given a graph G(V,E) as an adjacency matrix representation and a vertex, find the degree of the vertex v in the graph. Examples : 0-----1… Read More

We have introduced Graph implementation using array of vectors in Graph implementation using STL for competitive programming | Set 1. In this post, a different… Read More

Prerequisite – Graph Theory Basics – Set 1 A graph is a structure amounting to a set of objects in which some pairs of the… Read More

A graph is a data structure that consists of the following two components: 1. A finite set of vertices also called as nodes. 2. A finite set… Read More

Breadth First Traversal (or Search) for a graph is similar to Breadth First Traversal of a tree (See method 2 of this post). The… Read More

Depth First Traversal (or Search) for a graph is similar to Depth First Traversal of a tree. The only catch here is, unlike trees,… Read More