diff --git a/Pyvis/Pyvis_Visualize_awesome_notebooks_network.ipynb b/Pyvis/Pyvis_Visualize_awesome_notebooks_network.ipynb index 1026746ae0..47cda6b221 100644 --- a/Pyvis/Pyvis_Visualize_awesome_notebooks_network.ipynb +++ b/Pyvis/Pyvis_Visualize_awesome_notebooks_network.ipynb @@ -262,30 +262,32 @@ "net.force_atlas_2based()\n", "\n", "# Pull data\n", - "tools = list(df_temp['tool'])\n", - "images = list(df_temp['image_url'])\n", - "notebooks = list(df_temp['notebook'])\n", + "tools = df_temp['tool'].tolist()\n", + "images = df_temp['image_url'].tolist()\n", + "notebooks = df_temp['notebook'].tolist()\n", "\n", "# Create a dictionary of tools and images\n", "tool_img = dict(zip(tools, images))\n", "\n", "# Add tool nodes\n", - "for tool in tools:\n", + "for tool in set(tools):\n", " if tool == 'Naas':\n", - " net.add_node(tool, title=tool, image=tool_img[tool], shape='image', mass=30, size=150, level=1, fixed=True, x=0, y=0,physics=False)\n", - " if tool == 'OpenAI':\n", - " #this large node was bouncing around very fast, so I fixed it\n", + " # We set Naas as the center node\n", + " net.add_node(tool, title=tool, image=tool_img[tool], shape='image', mass=30, size=150, level=1, fixed=True, x=0, y=0, physics=False)\n", + " elif tool == 'OpenAI':\n", + " # OpenAI is a large node bouncing around very fast, so we let it be fixed\n", " net.add_node(tool, title=tool, image=tool_img[tool], shape='image', size=60, level=1, fixed=True, x=-1000, y=2000, physics=False)\n", " else:\n", - " net.add_node(tool, title=tool, image=tool_img[tool], shape='image',size=60,level=1, physics=False)\n", + " # All other tool nodes are of the same size and freely moving\n", + " net.add_node(tool, title=tool, image=tool_img[tool], shape='image',size=60,level=1)\n", "\n", "# Add notebook nodes\n", - "for notebook in notebooks:\n", - " net.add_node(notebook, title=notebook, size=30,level=2,color='#4d94db')\n", + "for notebook in set(notebooks):\n", + " net.add_node(notebook, title=notebook, size=30, level=2, color='#4d94db')\n", "\n", "# Add edges\n", "for _, node_e in df_temp.iterrows():\n", - " net.add_edge(node_e['tool'], node_e['notebook'], title=node_e['action'])\n", + " net.add_edge(node_e['tool'], node_e['notebook'], title=node_e['notebook_url'])\n", " \n", "level_1_count = 0\n", "level_2_count = 0\n",