Comments (1)
Took a look and found what I think this issue is here.
for node in nodes:
# check if node is `number-like`
try:
node = int(node)
self.add_node(node, **nd[node])
except:
# or node could be string
assert isinstance(node, str)
self.add_node(node, **nd[node])
So if one has str ids that could be int convertible (as my test case / real world example can), it's not possible to preserve the str type when calling bulk add.
add_edges
doesn't do this, directly (and blindly) passing the args to add_edge
.
for edge in edges:
# if incoming tuple contains a weight
if len(edge) == 3:
self.add_edge(edge[0], edge[1], width=edge[2])
else:
self.add_edge(edge[0], edge[1])
In my view, have add_nodes
just check for a valid type, but do not alter it. So something like:
for node in nodes:
if isinstance(node, int) or isinstance(node, str):
self.add_node(node, **nd[node])
else:
# error handling for improper id type
Also, I like how the args are parsed for nodes; it appears one can't pass keywords to add_edges()
and thus add_edge()
is far more flexible... thoughts on allowing add_edges()
to take any of the args add_edge()
will accpet?
from pyvis.
Related Issues (20)
- AttributeError: 'NoneType' object has no attribute 'render' HOT 4
- How do you change the fonts of the labels on the nodes?
- Be able to set the color of an edge independently of the source node
- Left to Right Orientation?
- Interactive Node in in Output HOT 1
- Use palette to color nodes and add colorbar
- Edge titles does not work? HOT 6
- Pyvis HTML Output does not use 100% of the page HOT 2
- Save as json
- Problem with labels, trying integration with pandas, Latex and Networkx
- No display of node labels if node is numeric HOT 1
- Change node size when label is inside
- Numeric string node ID silently cast from `str` to `int` in in `add_nodes` but not `add_edges`, raises `AssertionError`
- `write_html` opens browser to relative rather than absolute path, doesn't handle absolute paths as name
- Network not handling objects: assert isinstance(n_id, str) or isinstance(n_id, int) HOT 1
- Customizing Filter Menu Attribute Names in pyvis
- Loading Bar Toggle
- ModuleNotFoundError: No module named 'pyvis.network'; 'pyvis' is not a package
- pyvis node labels don't appear sometimes
- Applying physics to individual edges or applying different physics to each edge
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyvis.