def DFS(G, start_node):
    """
    :param G: Graph with G = {from_node1:[to_node1, to_node2], from_node2: [to_node,] etc}
    :param start_node: starting node to run BFS from
    :return: returns visited boolean array and path in which order it visited them
    """
    visited = [False for i in range(1, len(G) + 1)]
    path = [start_node]
    stack = []
    stack.append(start_node)

    while stack:
        v = stack.pop()
        if not visited[v - 1]:
            visited[v - 1] = True

            for connected_node in G[v]:
                if not visited[connected_node - 1]:
                    stack.append(connected_node)
                    path.append(connected_node)

    return visited, path