Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serializing data with node_link_json returns "data": null #1298

Open
EthanZoneCoding opened this issue Oct 18, 2024 · 0 comments
Open

Serializing data with node_link_json returns "data": null #1298

EthanZoneCoding opened this issue Oct 18, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@EthanZoneCoding
Copy link

Information

  • rustworkx version:
    rustworkx-0.15.1-cp38-abi3-win_amd64
  • Python version:
    Python 3.11.9
  • Rust version:
    N/A
  • Operating system:
    Windows 10 64 bit

What is the current behavior?

It returns a JSON string with null for the data field:

{"directed":false,"multigraph":true,"attrs":null,"nodes":[{"id":0,"data":null},{"id":1,"data":null},{"id":2,"data":null}],"links":[{"source":0,"target":1,"id":0,"data":null},{"source":0,"target":2,"id":1,"data":null},{"source":1,"target":2,"id":2,"data":null}]}

What is the expected behavior?

I should see somthing like
[{"id":0,"data":"A"}

Steps to reproduce the problem

This uses the quickstart example:

import rustworkx

G = rustworkx.PyGraph()
a = G.add_node("A")
b = G.add_node("B")
c = G.add_node("C")
G.add_edges_from([(a, b, 1.5), (a, c, 5.0), (b, c, 2.5)])
print(rustworkx.node_link_json(G))

I wasn't sure if I was supposed to pass anything to node_attrs or edge_attrs. Thanks

@EthanZoneCoding EthanZoneCoding added the bug Something isn't working label Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant