      "        graph.add_edge(2, 1, 6)\n",
      "        graph.add_edge(3, 2, 7)\n",
      "        graph.add_edge(3, 4, 8)\n",
      "\n",
      "        assert_equal(path_exists(nodes[0], nodes[2]), True)\n",
      "        assert_equal(path_exists(nodes[0], nodes[0]), True)\n",
      "        assert_equal(path_exists(nodes[4], nodes[5]), False)\n",
      "\n",
      "        print('Success: test_path_exists')\n",
      "\n",
      "\n",
      "def main():\n",
 
</s> remove     "        assert_equal(path_exists(nodes[0], nodes[2]), True)\n",
    "        assert_equal(path_exists(nodes[0], nodes[0]), True)\n",
    "        assert_equal(path_exists(nodes[4], nodes[5]), False)\n",
 </s> add     "        assert_equal(graph.path_exists(nodes[0], nodes[2]), True)\n",
    "        assert_equal(graph.path_exists(nodes[0], nodes[0]), True)\n",
    "        assert_equal(graph.path_exists(nodes[4], nodes[5]), False)\n", </s> remove         assert_equal(path_exists(nodes[0], nodes[2]), True)
        assert_equal(path_exists(nodes[0], nodes[0]), True)
        assert_equal(path_exists(nodes[4], nodes[5]), False)
 </s> add         assert_equal(graph.path_exists(nodes[0], nodes[2]), True)
        assert_equal(graph.path_exists(nodes[0], nodes[0]), True)
        assert_equal(graph.path_exists(nodes[4], nodes[5]), False) </s> remove     "        graph = Graph()\n",
 </s> add     "        graph = GraphPathExists()\n", </s> remove     "        graph = Graph()\n",
 </s> add     "        graph = GraphPathExists()\n", </s> remove     "def path_exists(start, end):\n",
    "    if start is None or end is None:\n",
    "        return False\n",
    "    if start is end:\n",
    "        return True\n",
    "    queue = deque()\n",
    "    queue.append(start)\n",
    "    start.visit_state = State.visited\n",
    "    while queue:\n",
    "        node = queue.popleft()\n",
    "        if node is end:\n",
 </s> add     "class GraphPathExists(Graph):\n",
    "\n",
    "    def path_exists(self, start, end):\n",
    "        if start is None or end is None:\n",
    "            return False\n",
    "        if start is end:\n",
    "        assert_equal(graph.path_exists(nodes[0], nodes[2]), True)\n",
    "        assert_equal(graph.path_exists(nodes[0], nodes[0]), True)\n",
    "        assert_equal(graph.path_exists(nodes[4], nodes[5]), False)\n",
      "        graph.add_edge(2, 1, 6)\n",
      "        graph.add_edge(3, 2, 7)\n",
      "        graph.add_edge(3, 4, 8)\n",
      "\n",
    "        assert_equal(graph.path_exists(nodes[0], nodes[2]), True)\n",
    "        assert_equal(graph.path_exists(nodes[0], nodes[0]), True)\n",
    "        assert_equal(graph.path_exists(nodes[4], nodes[5]), False)\n",
    "        assert_equal(graph.path_exists(nodes[0], nodes[2]), True)\n",
    "        assert_equal(graph.path_exists(nodes[0], nodes[0]), True)\n",
    "        assert_equal(graph.path_exists(nodes[4], nodes[5]), False)\n",
    "        assert_equal(graph.path_exists(nodes[0], nodes[2]), True)\n",
    "        assert_equal(graph.path_exists(nodes[0], nodes[0]), True)\n",
    "        assert_equal(graph.path_exists(nodes[4], nodes[5]), False)\n",
      "\n",
      "        print('Success: test_path_exists')\n",
      "\n",
      "\n",
      "def main():\n",
keep keep keep keep replace replace replace keep keep keep keep keep
 Move graph path exists to a class 
graphs_trees/graph_path_exists/path_exists_challenge.ipynb