Skip to content

Add node_list option to adjacency_matrix#1587

Open
techyangj wants to merge 1 commit into
Qiskit:mainfrom
techyangj:fix-adjacency-matrix-node-list
Open

Add node_list option to adjacency_matrix#1587
techyangj wants to merge 1 commit into
Qiskit:mainfrom
techyangj:fix-adjacency-matrix-node-list

Conversation

@techyangj
Copy link
Copy Markdown

@techyangj techyangj commented May 20, 2026

Closes #1411.

This adds an optional node_list argument to adjacency_matrix, graph_adjacency_matrix, and digraph_adjacency_matrix. The argument controls the output matrix row and column order and can be used to build a matrix for a subset of graph nodes.

Testing done:

  • cargo fmt --check
  • git diff --check
  • From tests/: python -m unittest graph.test_adjacency_matrix digraph.test_adjacency_matrix test_dispatch (85 tests)

Disclosure: I used AI assistance while preparing this patch, then reviewed the diff and validated it locally.

  • I ran rustfmt locally
  • I have added the tests to cover my changes.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 20, 2026

CLA assistant check
All committers have signed the CLA.

@techyangj techyangj force-pushed the fix-adjacency-matrix-node-list branch from 1b84d46 to 91239de Compare May 20, 2026 10:51
@coveralls
Copy link
Copy Markdown

Coverage Report for CI Build 26157815024

Coverage decreased (-0.002%) to 94.72%

Details

  • Coverage decreased (-0.002%) from the base build.
  • Patch coverage: 52 of 52 lines across 1 file are fully covered (100%).
  • 3 coverage regressions across 1 file.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

3 previously-covered lines in 1 file lost coverage.

File Lines Losing Coverage Coverage
rustworkx-core/src/generators/random_graph.rs 3 86.73%

Coverage Stats

Coverage Status
Relevant Lines: 20190
Covered Lines: 19124
Line Coverage: 94.72%
Coverage Strength: 925112.03 hits per line

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add networkx's node_list option to adjacency_matrix

3 participants