question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Indexes only work if NetworkX ids are integers

See original GitHub issue

_create_node and _create_edge accept only integers as ids (nx_id, from_id, to_id). The ids could be, e.g., strings. Graphviz Python libraries create node ids that are integers. If ids are not integers it’s impossible to generate valid Memgraph queries.

Take a look here (How to analyze Python, Cpp and Rust dependencies? PART 2) to see the details about the problem. The solution was to use gqlalchemy as a library and reuse some of the functions, but it’s definitely possible to push all the required capabilities into gqlalchemy.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
MasterMedocommented, Aug 14, 2021

I see two ways to tackle this.

  1. Add support for strings and escape the index when creating the cypher query with quotes.
  2. Support all data types by hashing the ID with a function to an integer.

What do you think, is there a better way for approaching this?

0reactions
gitbudacommented, Aug 18, 2021

Here is a minimal example, example.py produces queries that can’t be imported. Please rename the example files because .py and .dot can’t be directly uploaded here 😄

example_dot.txt example_py.txt requirements.txt

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: string indices must be integers, not str
The rest of my code rearranges the order the atoms/nodes in my networkx graph.I want to convert the output i get from my...
Read more >
relabel_nodes — NetworkX 2.8.8 documentation
Only the nodes specified in the mapping will be relabeled. Any non-node keys in the mapping are ignored. The keyword setting copy=False modifies...
Read more >
NetworkX Reference
If the topology of the network is all you care about then using integers or strings as the nodes makes sense and you...
Read more >
convert_node_labels_to_integers — NetworkX 2.8.8 ...
Returns a copy of the graph G with the nodes relabeled using consecutive integers. Parameters: Ggraph. A NetworkX graph. first_labelint, optional (default=0).
Read more >
Tutorial — NetworkX 2.8.8 documentation
This guide can help you start working with NetworkX. Creating a graph#. Create an empty graph with no nodes and no edges. >>>...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found