I have this code:
const int maxnodes = 5000;
struct Edge
{
int to, rev;
int f, cap;
};
vector g[maxnodes];
This is qui
This
int nodes = maxnodes, src, dest;
is a declaration that is equivalent to these three declarations
int nodes = maxnodes;
int src;
int dest;
This
vector g[maxnodes];
is a declaration of an array of objects of type std::vector. You can use the subscript operator with arrays.
So expression g[u] yields the element of the array with index u that is a reference to an object of type std::vector.
Class std::vector also overloads the subscript operator. So expression
g[u][j] gives the object of type Edge with index j in the vector of the array with index u.
Dcelaration
Edge &e = g[u][j];
declares a reference to this object of type Edge.