Constructing the undirected graph
graph [ 1 ] . Add ( 2 ) ; graph [ 2 ] . Add ( 1 ) ; graph [ 3 ] . Add ( 4 ) ; graph [ 4 ] . Add ( 3 ) ; graph [ 4 ] . Add ( 5 ) ; graph [ 5 ] . Add ( 4 ) ; graph [ 6 ] . Add ( 7 ) ; graph [ 7 ] . Add ( 6 ) ; maxSubarraySum ( graph , V , values ) ; } }