Skip to content

Conversation

SILIZ4
Copy link
Contributor

@SILIZ4 SILIZ4 commented Jun 8, 2024

The hyperbolic distance returned NaN for very close vertices. This meant the hyperbolic geometric graph generator wouldn't create edges that should exist.

I realized it didn't make sense to accept infinite coordinates (hyperbolic distance is undefined in most cases) and return an error instead.

I swapped the order of the parameters in the rustworkx-core api to match the rustworkx api.

Finally, it's inconvenient to specify the time coordinates since it can be computed using the other coordinates. Users only need to specify the useful coordinates.

SILIZ4 and others added 16 commits May 18, 2024 10:36
…kit#1195)

In the recently merged Qiskit#1192 a new generic DAG longest_path function was
added to rustworkx-core. However, the trait bounds on the function were
a bit tighter than they needed to be. The traits were forcing NodeId to
be of a NodeIndex type and this wasn't really required. The only
requirement that the NodeId type can be put on a hashmap and do a
partial compare (that implements Hash, Eq, and PartialOrd). Also the
IntoNeighborsDirected wasn't required because it's methods weren't ever
used. This commit loosens the traits bounds to facilitate this. At the
same time this also simplifies the code structure a bit to reduce the
separation of the rust code structure in the rustworkx crate using
longest_path().
This commit migrates the .cargo/config file which has been deprecated to
the new path .cargo/config.toml. This will fix warnings that are emitted
when compiling with the latest stable release. This new path has been
supported since Rust 1.38 which is much older than our current MSRV of
1.70.
@@ -0,0 +1,8 @@
fixes:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We never released the code so you don’t have to include release notes this time

@coveralls
Copy link

coveralls commented Jun 8, 2024

Pull Request Test Coverage Report for Build 9425909095

Details

  • 19 of 21 (90.48%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.004%) to 95.83%

Changes Missing Coverage Covered Lines Changed/Added Lines %
rustworkx-core/src/generators/random_graph.rs 18 20 90.0%
Files with Coverage Reduction New Missed Lines %
rustworkx-core/src/generators/random_graph.rs 1 85.04%
Totals Coverage Status
Change from base Build 9421992816: -0.004%
Covered Lines: 17350
Relevant Lines: 18105

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 8, 2024

Pull Request Test Coverage Report for Build 9428509697

Details

  • 19 of 21 (90.48%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.03%) to 95.863%

Changes Missing Coverage Covered Lines Changed/Added Lines %
rustworkx-core/src/generators/random_graph.rs 18 20 90.0%
Files with Coverage Reduction New Missed Lines %
rustworkx-core/src/generators/random_graph.rs 1 85.04%
Totals Coverage Status
Change from base Build 9421992816: 0.03%
Covered Lines: 17356
Relevant Lines: 18105

💛 - Coveralls

@IvanIsCoding IvanIsCoding merged commit 2ad86a4 into Qiskit:main Jun 8, 2024
SILIZ4 added a commit to SILIZ4/rustworkx that referenced this pull request Jul 4, 2025
* add hyperbolic random graph model generator

* Loosen trait constraints and simplify structure for longest_path (Qiskit#1195)

In the recently merged Qiskit#1192 a new generic DAG longest_path function was
added to rustworkx-core. However, the trait bounds on the function were
a bit tighter than they needed to be. The traits were forcing NodeId to
be of a NodeIndex type and this wasn't really required. The only
requirement that the NodeId type can be put on a hashmap and do a
partial compare (that implements Hash, Eq, and PartialOrd). Also the
IntoNeighborsDirected wasn't required because it's methods weren't ever
used. This commit loosens the traits bounds to facilitate this. At the
same time this also simplifies the code structure a bit to reduce the
separation of the rust code structure in the rustworkx crate using
longest_path().

* use vector references

* change to slice (clippy)

* generalize to H^D, improve numerical accuracy

* allow infinite coordinate

* handle infinity in hyperbolic distance

* remove unused import (clippy)

* fix python stub

* Rename deprecated cargo config file (Qiskit#1211)

This commit migrates the .cargo/config file which has been deprecated to
the new path .cargo/config.toml. This will fix warnings that are emitted
when compiling with the latest stable release. This new path has been
supported since Rust 1.38 which is much older than our current MSRV of
1.70.

* fix hyperbolic distance, swap r and beta, infer time coordinate

* use mul_add in hyperbolic distance, remove release note

* replace clone with dereference

---------

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Co-authored-by: Ivan Carvalho <8753214+IvanIsCoding@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
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.

4 participants