C++ algoritm that shows the vertices with a known degree