Neyla Adam wrote:now the compilation problem is solved: i had to declare the package..
now I get those errors though ... and I do not understand why.. does anyone get it?
The stacktrace gives you tons of information...
Neyla Adam wrote:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at aww.Main5.augmentingPathExists(Main5.java:24)
at aww.Main5.computeMaximumFlow(Main5.java:50)
at aww.Main5.main(Main5.java:120)
Basically, your main() method called the computeMaximumFlow() method, which called the augmentingPathExists() method. And somewhere in the augmentingPathExits() method, around line 24 of the Main5.java file, you encountered the error.
The error is an ArrayIndexOutOfBounds exception, which is what is thrown when trying to dereference an array. Additionally, you are trying to get element zero, which is the first element of the array. And it failed, which means that the array doesn't have a first element.
Following this, it is likely your "visited" array, which you probably instantiated to hold zero elements. Put a debugging message, either at the instantiation of the array, or before accessing the array, to confirm the size... and you will see the issue.
Henry