# Could someone implement push-relabel algorithm(to find max flow in a graph) in c

``````int push(int ind){
for(int i=0;i<n;i++){
if(graph(ind)(i)>0){
if(flow(ind)(i)==graph(ind)(i))
continue;

if(height(ind)>height(i)){
int flows=mini(graph(ind)(i)-flow(ind)(i),excess(ind));
excess(ind) -= flows;
excess(i) += flows;
flow(ind)(i) += flows;
flow(i)(ind)-=flows;
return 1;
}
}

}
return 0;
}
void relabel(int u)
{

int mh = 100000;

for (int i = 0; i < n; i++)
{
if (graph(u)(i))
{
if (flow(u)(i) == graph(u)(i))
continue;

if (height(i) < mh)
{
mh = height(i);
height(u) = mh + 1;
}
}
}
} ```

graph(i)(j) represents edge graph from node i to j.
flow(i)(j) represents current flow from node i to j.
height(i) represents the height of ith node.
Concept of height is used to check possible flows.(high to low flow is possible).
excess(i) represents difference in incoming flow - outgoing flow.

Initially height(source)=number of nodes.
for (each edge from source to connected node)
excess(i)=edge capacity

the current code is giving me runtime error.
``````