Completed maximum-flow algorithm on javascript.