I have to write a function that will return a set
that contains neighbours of a source vertex in given distance. For example for exemplary graph:
{0: [1, 3],
1: [2],
2: [],
3: [4],
4: [1, 5],
5: [],
6: [1]}
By passing this graph to a function + the source vertex which is 0 and passing distance = 2 the result should be: {1,2,3,4}
.
How can I achieve that?