Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add token swapper to rustworkx-core #765

Merged
merged 50 commits into from
Apr 18, 2023
Merged
Show file tree
Hide file tree
Changes from 49 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
052cdc4
Add token swapper
enavarro51 Oct 24, 2022
90f49e8
Finish add_token_edges setup rand
enavarro51 Nov 22, 2022
1f66b47
Finish main fn
enavarro51 Nov 23, 2022
bd7a9a3
Add swap fn
enavarro51 Nov 24, 2022
ea5b0da
Add find_cycle and start trial_map
enavarro51 Dec 1, 2022
223e94e
Finish good compile code
enavarro51 Dec 8, 2022
3f32358
Merge conflict
enavarro51 Dec 8, 2022
6e22ade
First testing
enavarro51 Dec 9, 2022
1e9c2da
Rebuild swapper using struct and impl
enavarro51 Dec 13, 2022
fedaa3f
Restructure around struct and token_swapper
enavarro51 Dec 14, 2022
cad5c38
Fix find_cycle and passing copies
enavarro51 Dec 18, 2022
229bfa5
First test success and cleanup
enavarro51 Dec 21, 2022
832f506
More testing and simplify di and sub_di graph
enavarro51 Dec 22, 2022
f804026
Finish tests
enavarro51 Dec 24, 2022
0f3f8e3
Format
enavarro51 Dec 24, 2022
9797e20
Lint
enavarro51 Dec 24, 2022
6ee863f
Add python interface
enavarro51 Dec 26, 2022
8ed61ac
Merge branch 'main' into token_swapper
enavarro51 Dec 26, 2022
7b27ab2
Fix limit calc
enavarro51 Dec 27, 2022
bd00d6d
Merge branch 'main' into token_swapper
enavarro51 Jan 28, 2023
19a7e60
Merge main
enavarro51 Feb 4, 2023
162d71e
Fix pyo3 signature
enavarro51 Feb 4, 2023
f050aee
One more time
enavarro51 Feb 4, 2023
779da9f
pyo3 fix
enavarro51 Feb 4, 2023
3632e8e
Fix signature 2
enavarro51 Feb 4, 2023
96b9b8c
Add python tests
enavarro51 Feb 6, 2023
5fe53de
Cleanup and reno
enavarro51 Feb 6, 2023
2f64365
Merge branch 'main' into token_swapper
enavarro51 Feb 6, 2023
2a0815b
Fix conflict
enavarro51 Feb 7, 2023
fec8c60
Merge main
enavarro51 Feb 7, 2023
801ffb1
Use connectivity::find_cycle
enavarro51 Mar 8, 2023
a668106
Merge branch 'main' into token_swapper
enavarro51 Mar 8, 2023
2d74c45
Review updates
enavarro51 Mar 10, 2023
40d2a88
Merge branch 'token_swapper' of github.com:enavarro51/rustworkx into …
enavarro51 Mar 10, 2023
3cb32bf
Merge branch 'main' into token_swapper
enavarro51 Mar 10, 2023
1a10e4b
Switch to map
enavarro51 Mar 13, 2023
4992233
Merge branch 'main' into token_swapper
enavarro51 Mar 13, 2023
97d3ff2
Merge branch 'token_swapper' of github.com:enavarro51/rustworkx into …
enavarro51 Mar 13, 2023
83ccd8c
Convert trial_map to parallel
enavarro51 Mar 14, 2023
ae1a971
Merge branch 'main' into token_swapper
enavarro51 Mar 14, 2023
805be9c
Fix seed changes
enavarro51 Mar 14, 2023
402e226
Cleanup and comments
enavarro51 Mar 16, 2023
87b377a
Name changes
enavarro51 Mar 17, 2023
7a7ae3b
Finish docs and add threshold
enavarro51 Mar 22, 2023
36750f8
Merge branch 'main' into token_swapper
enavarro51 Mar 22, 2023
3e7ee22
Merge branch 'main' into token_swapper
enavarro51 Mar 25, 2023
0a56fd8
Fix stable graph removed nodes and error msgs
enavarro51 Apr 6, 2023
a2855d3
Merge branch 'token_swapper' of github.com:enavarro51/rustworkx into …
enavarro51 Apr 6, 2023
8171f03
Merge branch 'main' into token_swapper
enavarro51 Apr 6, 2023
da1d7cc
Merge branch 'main' into token_swapper
mergify[bot] Apr 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ typed API based on the data type.
rustworkx.graph_complement
rustworkx.graph_union
rustworkx.graph_tensor_product
rustworkx.graph_token_swapper
Copy link
Member

Choose a reason for hiding this comment

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

Since we don't have a digraph_token_swapper I'm wondering if there is a better section for this. But we can just do this in a followup, it's not critical.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I vote for let it be for now.

rustworkx.graph_cartesian_product
rustworkx.graph_random_layout
rustworkx.graph_bipartite_layout
Expand Down
6 changes: 6 additions & 0 deletions releasenotes/notes/added-token-swapper-bd168eeb5a31bd99.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
features:
- |
Added a new function, :func:`~.token_swapper()` which performs an
approximately optimal Token Swapping algorithm and supports partial
mappings (i.e. not-permutations) for graphs with missing tokens.
2 changes: 2 additions & 0 deletions rustworkx-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ keywords = ["graph"]
ahash = "0.8.0"
fixedbitset = "0.4.2"
petgraph = "0.6.3"
rand = "0.8.5"
rand_pcg = "0.3.1"
rayon = "1.6"
num-traits = "0.2"
priority-queue = "1.2"
Expand Down
3 changes: 3 additions & 0 deletions rustworkx-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
//! * [`connectivity`](./connectivity/index.html)
//! * [`max_weight_matching`](./max_weight_matching/index.html)
//! * [`shortest_path`](./shortest_path/index.html)
//! * [`token_swapper`](./token_swapper/index.html)
//! * [`traversal`](./traversal/index.html)
//! * [`generators`](./generators/index.html)
//!
Expand Down Expand Up @@ -82,6 +83,8 @@ pub mod traversal;
pub mod dictmap;
pub mod distancemap;
mod min_scored;
/// Module for swapping tokens
pub mod token_swapper;
pub mod utils;

// re-export petgraph so there is a consistent version available to users and
Expand Down
Loading