A small querry in floyd waeshall

can this algorithm also work for undirected weighted graph

hey @soumadeepbagui2 , yes it does.

for example if there is a (undirected)edge 1,2 with cost 10 the the matrix[1][2]=matrix[2][1] = 10 right?? for floyd warshall

I am not clear about how floyd warshall work with negative edges as we can say that same for bellman ford can too work with negative cycle if we dont run for again to check the negative cycle detection

Yes

Floyd warshall detects negative cycle + it’s all pair shortest path algo
Bellman ford detects negative cycle + it’s single source shortest path algo

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.