add vertex constraint to neural net