Thread: Shortest path in an unweighted graph

  1. #1
    Registered User
    Join Date
    Oct 2020

    Post Shortest path in an unweighted graph

    Given an unweighted graph, a source and a destination, how can I find shortest path from source to destination in the graph in most optimal way? I need help in writing this program in C.

    Sample input and output:

    Input: source vertex = 0 and destination vertex is = 7.
    The adjacency list for the graph.
    Output: Shortest path length is:2
    Path is: 0 3 7
    Last edited by cquestions; 10-11-2020 at 08:25 PM.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    You start with some research.
    Shortest path problem - Wikipedia

    Then you decide on a data structure to represent " The adjacency list for the graph."
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 21
    Last Post: 02-08-2014, 11:56 AM
  2. Replies: 7
    Last Post: 05-02-2012, 06:44 AM
  3. Shortest path
    By anirban in forum Tech Board
    Replies: 3
    Last Post: 06-10-2008, 11:42 PM
  4. Shortest path problem
    By Digitalxero in forum C++ Programming
    Replies: 0
    Last Post: 10-25-2005, 05:32 PM
  5. Help!!! Shortest path graph
    By hansy32 in forum C Programming
    Replies: 5
    Last Post: 03-01-2002, 06:39 PM

Tags for this Thread