Check if a graph is strongly connected or not
Given a directed graph, check if it is strongly connected or not. A directed graph is said to be strongly connected if every vertex is reachable from every other vertex.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedGiven a directed graph, check if it is strongly connected or not. A directed graph is said to be strongly connected if every vertex is reachable from every other vertex.
Given a directed graph, check if it is a DAG (Directed Acyclic Graph) or not. A DAG is a digraph (directed graph) that contains no cycles.
A connected graph G is said to be 2–vertex connected (or 2–connected) if it has more than 2 vertices and remains connected on the removal of any vertices. Any such vertex whose removal will disconnect the graph is called the Articulation point.
Given an undirected connected graph, check if the graph is 2–edge connected or not. A connected graph is 2–edge connected if it remains connected whenever any edges are removed.
Given an undirected graph, check if it is a tree or not. In other words, check if a given undirected graph is an Acyclic Connected Graph or not.
Given a connected undirected graph, find if it contains any cycle or not. For example, the following graph contains a cycle 2–5–10–6–2.
The transitive closure for a digraph G is a digraph G’ with an edge (i, j) corresponding to each directed path from i to j in G. The resultant digraph G’ representation in the form of the adjacency matrix is called the connectivity matrix.
Given a Directed Acyclic Graph (DAG), print it in topological order using topological sort algorithm. If the DAG has more than one topological ordering, output any of them.
This post describes the types of edges involved in Depth–first search (DFS) of a tree and directed & undirected graphs and establish the relation between them.
The arrival time is the time at which the vertex was explored for the first time in the DFS, and departure time is the time at which we have explored all the neighbors of the vertex, and we are ready to backtrack.
Depth–first search (DFS) is an algorithm for traversing or searching tree or graph data structures. One starts at the root (selecting some arbitrary node as the root for a graph) and explore as far as possible along each branch before backtracking.