Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

edge_list and node_list behave unexpectedly in graph generators

Open
#245 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
data

Research direction

Start by running the dnx.pegasus_graph(2) reproduction with reversed node_list and the matching edge_list. Inspect the graph generator entry point and related generator behavior, then verify that node_list controls node order and edge_list controls edge order without changing the graph; check the interaction with minorminer.subgraph.find_subgraph(S, T).

Written by the indexing model from the issue text.

Description

Description
It is useful to permute node and edge orderings in graph creation for example to randomize the behaviour of otherwise deterministic methods.

  • dwave_networkx graph node ordering doesn't seem to respond to the ordering of the node_list parameter.
  • When the edge_list parameter is provided matching the default, the node_ordering is changed relative to the default.

To Reproduce

T = dnx.pegasus_graph(2)
node_list = list(T.nodes())
node_list.reverse()
T2 = dnx.pegasus_graph(2, node_list=node_list)  # Same graph
print(T2.nodes())  # original ordering, ignores provided ordering.
edge_list = list(T1.edges())
node_list = list(T1.nodes())
T3 = dnx.pegasus_graph(2, node_list=node_list, edge_list=edge_list)
print(T3.nodes())  # Does not match T1.nodes(), which is unexpected.

Expected behavior
node_list should dictate node order, edge_list should dictate edge order.

Environment:

  • OS: [Ubuntu 22.04.3 LTS]
  • Python version: [e.g. 3.12.0]

Additional context
I'll make a pull request to correct this unless a good case can be made not to, don't really want to mess with these core generators unnecessarily.
I want to use in combination with minorminer.subgraph.find_subgraph(S, T) which deterministically searches for a subgraph. Reordering the target (T) nodes allows a more uniform distribution across the processor with respect to some source graph S.

Dominant language
Python
Stars
94
Forks
62
Avg merge
1d 2h
Merged PRs (30d)
1

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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 dwavesystems/dwave-graphs

All issues in dwavesystems/dwave-graphs

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.