You are not logged in. Please login at to post your questions!


Shortest path from BFS and DFS

Hi all, I recently learnt how to implement breadth-first-search (BFS) using C++ STL vector. However, though I know the algorithm of depth-first-search (DFS) but cannot understand how to implement it using C++ STL. Please provide me a code using C++ STL to implement it. Also kindly tell me how the shortest path algorithms (such as Dijkstra's algorithm or Floyd-Warshall's algorithm) can be derived from BFS and DFS.

Thanks in advance!

asked 21 Jan '15, 23:08

anupam_datta's gravatar image

accept rate: 7%

plz make ur query a bit more clear

(23 Jan '15, 15:42) arpanb83★


answered 22 Jan '15, 14:14

ketanhwr's gravatar image

accept rate: 15%

toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 21 Jan '15, 23:08

question was seen: 6,700 times

last updated: 23 Jan '15, 15:42