Driver code to test above methods
int main ( ) { int edges [ ] [ 2 ] = { { 1 , 0 } , { 0 , 3 } , { 0 , 8 } , { 2 , 3 } , { 3 , 5 } , { 3 , 6 } , { 3 , 7 } , { 4 , 5 } , { 5 , 9 } } ; int V = sizeof ( edges ) / sizeof ( edges [ 0 ] ) ; int marked [ ] = { 1 , 2 , 4 } ; int N = sizeof ( marked ) / sizeof ( marked [ 0 ] ) ; int K = 3 ; cout << nodesKDistanceFromMarked ( edges , V , marked , N , K ) ; return 0 ; }