there is a mistake in your code, same names, w and v
struct Edge{
int w_,v_;
Edge(int v=-1,int w=-1) //this is a contructor
: v_(v), w_(w) //this is member initialization list, it provides a mechanism than you can direct-initialize the objects of class type.
{ }
};