We have implemented here a naive implementation of the preceeding BFS pseudocode, where a graph is implemented as:
G = {
5 : [3, 7, 9],
3 : [2, 4, 10],
7 : [8],
2 : [],
4 : [8, 9],
8 : [],
9 : [12, 11],
10: [13, 10, 8, 9],
11: [3, 7, 9],
12: [],
13: []}