About 227,000 results
Open links in new tab
  1. C program to implement DFS traversal using Adjacency Matrix

    Jan 13, 2022 · Given a undirected graph with V vertices and E edges. The task is to perform DFS traversal of the graph. Examples: Explanation: The traversal starts from 0 and follows the following path 0-1, 1-3, 1-4, 1-5, 1-6, 6-2. Explanation: There is no other vertex than 0 itself. Approach: Follow the approach mentioned below.

  2. C Program for DFS traversal in Graph - w3resource

    Mar 19, 2025 · Write a C program to implement recursive DFS on a graph represented by an adjacency matrix and output discovery/finishing times. Write a C program to perform DFS iteratively using a stack and print the order of visited vertices.

  3. BFS Graph Algorithm (With code in C, C++, Java and Python)

    Breadth first traversal or Breadth first Search is a recursive algorithm for searching all the vertices of a graph or tree data structure. In this tutorial, you will understand the working of bfs algorithm with codes in C, C++, Java, and Python.

  4. Implement DFS Traversal Using Adjacency Matrix in C

    Aug 9, 2023 · DFS traversal, based on a depth-first approach, allows us to explore the depths of a graph before backtracking and exploring other branches. In this article, we will involve in implementing DFS traversal using an adjacency matrix representation in C.

  5. BFS Program in C | Breadth First Search - Sanfoundry

    Here is a BFS Program in C using adjacency matrix, adjacency list and queue along with the explanation, examples and time complexity.

  6. GitHub - Pranab1991/Adjacency-List-Adjacency-Matrix-BFS-and-DFS

    This project is an effort to implement deapth first and breadth first search in Graph. Graph representation using both Matrix and LinkedList demoed. Genenerics was used to have an template base approach Depth-first search : Depth-first search (DFS) is an algorithm for traversing or searching tree or graph data structures.

  7. C Program for Depth - First Search in Graph (Adjacency Matrix)

    Depth First Search is a graph traversal technique. The source is the first node to be visited, and then the we traverse as far as possible from each branch, backtracking when the last node of that branch has been visited. Here is the C implementation of Depth First Search using the Adjacency Matrix representation of graph.

  8. So, with adjacency matrix, BFS is O(n2) independent of the number of edges m. With adjacent lists, BFS is O(n+m); if m=O(n2) like in a dense graph, O(n+m)=O(n2).

  9. A lot of times to solve basic graph problems (which show up in technical interviews at this level), and often the answer is that you just need to describe / implement BFS/DFS with a small modification for your specific problem.

  10. Implementation of BFS using adjacency matrix - GeeksforGeeks

    Feb 15, 2023 · Breadth First Search (BFS) has been discussed in this article which uses adjacency list for the graph representation. In this article, adjacency matrix will be used to represent the graph.

Refresh