Sir, where am I doing mistake ? please help me to remove that

hello @chandreshmaurya

u havent complete the bfs code.
u have marked only immediate negibours distance as 6 ,what about other nodes?

check this->

Sir, I’m getting problem in dry run. when i do dry run, i get β€œ6, 6, 12” in 1st input and β€œ12, 6” in 2nd input. which is incorrect

sir, please help me to understand this code with dry run.

It’s simple bfs.

If u are having any issue in understanding this. Then simply apply ur standard bfs and then multiply each of its distance by 6

Sir, Actually I’m not getting the the question. in question, it is said that when " if β€˜s’ is disconnected from a node, print -1 as the distance to that node. "… but, jo input me graph diya hai usme to koi bhi node disconnected nhi hai, phir bhi output me β€œ-1” result aa rha hai

Sir, mujhe given input se output ko smjha dijiye. please

4 2
1 2
1 3
1
ise dekho , yaha pe 4 veritces has (1,2,3,4) aur 2 edges hai (1-2, 1-3)

aur source 1 hai , to 1 se hum 2 pe 6 cost me pahuch sakte hai
similary 1 se 3 pe 6 cost me pahuch skate hai
1 se 4 pe nahi jaa skate isiliye uske liye -1
isiliye output
6 6 -1 diya hua hai

thank you sir, Now it’s clear. mai question ko hi galat smjh rha tha

Sir, i did as u told. But, i’m getting segmentation fault. please help me to remove my error from yhe code. My code-> https://ide.codingblocks.com/s/483509

make ur distance array of size v+1

sir, i’m still getting segmentattion fault. please check my code. code-> https://ide.codingblocks.com/s/483642

check now

done sir, thank you …