Negative Cycle in Directed weigthed graph

Правка en4, от Peace_789, 2020-06-11 21:41:24

Hello Everyone ...

Today I was solving this problem ... Problem statement : You are given a directed weighted graph, and your task is to find out if it contains a negative cycle, and also give an example of such a cycle.

I am aware of solving this problem using Bellman Ford's Algorithm , But I am trying another approach which is giving me WA in 1 Test Case (total 13 is there) .

So , Can anyone point out whether this approach is correct or not ... and If it is correct then suggest me some modification otherwise give some counter examples where this code might fail.

code

Thanks in advance :) and sorry for my bad english.

Теги #graph theory, #cycle, #doubt

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en4 Английский Peace_789 2020-06-11 21:41:24 944 Tiny change: '="code">\n...\n\n~~~~~\nYour code here...\n#include' -> '="code">\n~~~~~\n#include'
en3 Английский Peace_789 2020-06-11 15:26:27 18 Tiny change: ' directed graph,' -> ' directed weighted graph,'
en2 Английский Peace_789 2020-06-11 15:16:48 503
en1 Английский Peace_789 2020-06-11 15:08:27 2980 Initial revision (published)