+ 1

Good day guys, please I need urgent assistance. Determine connectivity of two vertex in DG

Given a directed graph, You are required to design a function like:int connect(AdjList *G,char v1[],char v2[]);where v1 and v2 are two vertex, if there is path from v1 to v2, return yes, otherwise return no. Input first line enter 2 numbers for(nv,ne). second line enter the all vertex data (such A B C D…) start from third line, enter edge information,each edge is in form of v1 v2 w Where v1 is starting vertex and v2 is end vertex data, w is weight of the edge. separated by space. Last line enter two vertex to test if there is pass between them. Output output yes or no in one line, without any space. I did so,but it returns 1 and 0 instead of yes and no. Please I need help to return yes and no instead of 1 and 0. https://code.sololearn.com/cKT92BfH7s9c/?ref=app https://code.sololearn.com/cKT92BfH7s9c/?ref=app https://code.sololearn.com/cKT92BfH7s9c/?ref=app Input 6 9 A B C D E F A B 3 A C 3 B D 1 D A 2 C B 3 D C 5 C E 2 E D 4 D F 6 C F

9th May 2022, 5:38 AM
Baby
Baby - avatar
3 Respuestas
+ 1
Thanks a lot
9th May 2022, 11:04 AM
Baby
Baby - avatar
0
Try this way: int r = connect(&G, v1,v2); r==1 ? puts("yes") : puts("no"); Hope it helps..
9th May 2022, 8:49 AM
Jayakrishna 🇮🇳
0
You're welcome...
9th May 2022, 11:15 AM
Jayakrishna 🇮🇳