1

enter image description here

I want to visualize network with selection different nodes. For better understanding the problem attached this code.

from pyvis.network import Network
G = nx.Graph()
rels = [
    ["Fred", "George"],
    ["Harry", "Rita"],
    ["Fred", "Ginny"],
    ["Tom", "Ginny"],
    ["Harry", "Ginny"],
    ["Harry", "George"],
    ["Frank", "Ginny"],
    ["Marge", "Rita"],
    ["Fred", "Rita"]
]
G.add_edges_from(rels)

net = Network(notebook=True, height="750px", width="100%", bgcolor = '#222222', font_color = 'white', select_menu=True)
net.from_nx(G)
net.save_graph("networkx-pyvis.html")

I use pyvis select_menu=True and my net doesn't exist. If I delete select_menu=True, my network appear.

STerliakov
  • 4,983
  • 3
  • 15
  • 37

2 Answers2

0

How to use select menu in pyvis network?

Passing cdn_resources='remote' in Network worked for me.

In your case the following should work:

net = Network(notebook=True, height="750px", width="100%", bgcolor = '#222222', font_color = 'white', select_menu=True, cdn_resources='remote')

Possible reason for this would be that, pyvis is not able to find the required cdn resources in our local directory.

0

select_menu in Pyvis network

I tried many options and above solution as well but got below error

----> 5 net = Network(notebook=True, height="750px", width="100%", bgcolor = '#222222', font_color = 'white', select_menu=True, cdn_resources='remote')

TypeError: __init__() got an unexpected keyword argument 'select_menu'

Note : same error appears for "filter_menu" as well.

Ankit Raj
  • 1
  • 1
  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/33890688) – Shawn Hemelstrand Feb 26 '23 at 03:28