Let us create the following weighted graph 1 ( 0 ) -- -- -- -- -- -> ( 1 ) / | \ | | | - 1 | | - 1 | \ | / ( 3 ) < -- -- -- -- -- - ( 2 ) - 1
int graph [ V ] [ V ] = { { 0 , 1 , INF , INF } , { INF , 0 , -1 , INF } , { INF , INF , 0 , -1 } , { -1 , INF , INF , 0 } } ; if ( negCyclefloydWarshall ( graph ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }