-
Notifications
You must be signed in to change notification settings - Fork 10
Description
Describe the bug
If relationships are specified where the source or target is missing from the nodes DataFrame, no error is raised or printed, instead the visualisation produced is entirely empty.
Edit: This also happens when creating Relationship objects directly, as described here. This is not specific to using DataFrames.
To Reproduce
from pandas import DataFrame
from neo4j_viz.pandas import from_dfs
nodes = DataFrame({
"id": ["a", "b", "c"],
"caption": ["Alice", "Bob", "Charlie"],
"size": [20, 10, 10],
})
relationships = DataFrame({
"source": ["a", "b", "d"], # The node 'd' does not exist
"target": ["b", "c", "e"], # The node 'e' does not exist
"caption": ["KNOWS", "KNOWS", "KNOWS"],
})
VG = from_dfs(nodes, relationships)
VG.render()graph-viz library version: 1.0.0
Python version: 3.12.9
Operating system: Ubuntu 22.04.5 LTS
Steps to reproduce the behaviour:
Create a new notebook with a cell containing the above code. After running it the visualisation canvas is empty. I cannot see any error messages or warnings in the notebook.
Expected behaviour
Either an exception is raised explaining that a row in relationships references nodes which are missing, or a warning printed and any rows with missing node references ignored. The latter would be preferable as it would make using samples from a DataFrame easier.