Spuneti-mi va rog unde gresesc

Am incercat sa fac in felul urmator:
pentru o muchie x y si x1-fluxul propus de angajat, y1-fluxul maxim pe muchie, adaug
cost [ x ] [ y ]-costul de intretinere; cost [ y ] [ x ]=-cost [ x ][ y ];
capacitate [ y] [ x]=x1; capacitate [ x] [ y]=y1-x1;
acum pot merge pe o muchie doar daca capcitate [ x][ y]>0;
Dupa ce mi-am format graful in acest fel fac un dfs din sursa sa vad daca pot ajunge la destinatie, daca ajung rezulta ca voi putea mari fluxul cu capacitatea minima de pe drum, respectiv in acest caz consider planul angajatului gresit.
Daca nu am ajuns la destinatie controlez daca exista ciclu de cost negativ cu Bellman Ford, daca exista iarasi consider planul gresit, daca nu atunci planul este corect.
Iau incorect.
