Found 33 Articles for Graph Algorithms

Check if a given graph is tree or not

karthikeya Boyini
Updated on 16-Jun-2020 11:46:28

4K+ Views

In this problem, one undirected graph is given, we have to check the graph is tree or not. We can simply find it by checking the criteria of a tree. A tree will not contain a cycle, so if there is any cycle in the graph, it is not a tree.We can check it using another approach, if the graph is connected and it has V-1 edges, it could be a tree. Here V is the number of vertices in the graph.Input and OutputInput: The adjacency matrix. 0 0 0 0 1 0 0 0 0 1 0 0 0 ... Read More

Bridges in a Graph

Samual Sam
Updated on 16-Jun-2020 10:48:32

2K+ Views

An edge in an undirected graph is said to be a bridge, if and only if by removing it, disconnects the graph, or make different components of the graph. In a practical approach, if some bridges are present in a network when the connection of bridges is broken, it can break the whole network.Input and OutputInput: The adjacency matrix of the graph. 0 1 1 1 0 1 0 1 0 0 1 1 0 0 0 1 0 0 0 1 0 0 0 1 0 Output: Bridges in given graph: Bridge 3--4 Bridge 0--3AlgorithmbridgeFind(start, visited, disc, low, ... Read More

Biconnected Graph

Samual Sam
Updated on 16-Jun-2020 09:20:10

4K+ Views

An undirected graph is said to be a biconnected graph, if there are two vertex-disjoint paths between any two vertices are present. In other words, we can say that there is a cycle between any two vertices.We can say that a graph G is a bi-connected graph if it is connected, and there are no articulation points or cut vertex are present in the graph.To solve this problem, we will use the DFS traversal. Using DFS, we will try to find if there is any articulation point is present or not. We also check whether all vertices are visited by ... Read More

Advertisements