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