RE: Problem with graph:johnson_all_pairs_shortest_paths
So, you get a code like: const int V = n; int D[V][V]; In this case, 'V' is not a compile time constant and the second line >is not valid -- array bounds must be compile time constant. I have no idea why you get the error you get, instead of >error right at the point where array is declared. Most likely, this is diagnostic problem in the rather ancient (;-)) version of >gcc that you're using. Ok, so what's the right say to do this kind of dynamically-sized problem? Keith
keith.briggs@bt.com wrote:
So, you get a code like: const int V = n; int D[V][V]; In this case, 'V' is not a compile time constant and the second line >is not valid -- array bounds must be compile time constant. I have no idea why you get the error you get, instead of >error right at the point where array is declared. Most likely, this is diagnostic problem in the rather ancient (;-)) version of >gcc that you're using. Ok, so what's the right say to do this kind of dynamically-sized problem?
vector< vector<int> > D(V, vector<int>(V)); - Volodya
participants (2)
-
keith.briggs@bt.com
-
Vladimir Prus