Bfs

There's a total of 2 articles.




Single Source Shortest Path (SSSP) in a graph

Single Source Shortest Path (SSSP) in a graph

Given a weighted graph $G$ with $V$ vertices and $E$ edges where all the weights are non-negative and given a source vertex $s$, the single source shortest path problem consists in finding the distance from $s$ to all the other vertices.


In this article I describe the problem in a weighted and unweighted graph as well as implementations using BFS for unweighted graphs and Dijkstra's algorithm for weighted graphs using an array and a priority queue.
Me
Published on Fri, Jul 3, 2015
Last modified on Sun, Jun 16, 2024
1248 words - Page Source

Traversal of graphs

Traversal of graphs

There are many ways to traverse a graph. For example through breadth-first search and depth-first search. Exploring it with a breadth-first search has interesting properties like implicitly computing the distance from a source $s$ to all the reachable vertices. Exploring it with a depth-first search has properties about edges like finding back edges, forward edges and cross edges.


This article has implementations for both BFS and DFS.
Me
Published on Wed, Jun 24, 2015
Last modified on Sun, Jun 16, 2024
970 words - Page Source