[joss] Questions about graph creation

Open
#503 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
25/100
Issue type
Documentation
Clarity
Needs clarification
Activity status
Stale
Tech stack
python, rust
Domain
api

Research direction

Start with the PyGraph and extend_from_edge_list entry points shown in the issue, then check the existing API documentation for named edge lists and node lookup. Done means the supported approach for string or numeric node names and index lookup is clearly documented, or the missing API behavior is identified.

Written by the indexing model from the issue text.

Description

This is not a bug report, just a question. I hope it's fine to ask it here, since there is currently no forum-like alternative for support questions.

How can I create a graph from a list of edges in terms of node names (not indices)? For example, I can create an undirected graph from an edge list given in terms of indices like this:

g=rx.PyGraph()
g.extend_from_edge_list([(0,1),(1,2)])

But what if I have node names, e.g. [('a', 'b'), ('b', 'c')]? I suspect that I am missing some simple way to handle such edge lists. Or perhaps the list is [(10,20),(20,5)], where the three nodes of the graphs would be named 10, 20 and 5.

Once the graph is created, how can I refer to nodes by name instead of by their index? How can I look up the index of node 'c', for example?

Dominant language
Rust
Stars
1.8k
Forks
220
Avg merge
3d 16h
Merged PRs (30d)
3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Qiskit/rustworkx

All issues in Qiskit/rustworkx

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.