With OR-Tools (very good idea) :
1. Allow the solver to drop all nodes with the AddDisjunction() method <
2. Add the (custom) constraint $$ \sum_{v \in V} x_v = 5$$ where $x_v$ takes value $1$ iff node $v$ is visited. You need to use the solver().Add() method :<