I guess
typename graph_traits<Graph>::vertex_descriptor NodeID;
should be
typedef typename graph_traits<Graph>::vertex_descriptor NodeID;
The upper variant is a declaration of a variable NodeID
of type graph_traits<Graph>::vertex_descriptor
, while the latter is a typedef for the same type.