def METHOD_NAME(visited, graph, node):
    visited.append(node.GetIdx())
    queue.append(node)
    while queue:
        s = queue.pop(0)
        neighbours = s.GetNeighbors()
        for neighbour in neighbours:
            nidx = neighbour.GetIdx()
            if nidx not in visited:
                visited.append(nidx)
                queue.append(neighbour)
    return visited