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 graph6 format encoder and decoder for undirected graphs #658

Merged
merged 2 commits into from
Nov 24, 2024

Conversation

BryanCruz
Copy link
Contributor

@BryanCruz BryanCruz commented Aug 19, 2024

Add graph6 format encoder and decoder for undirected graphs.

Format for storing undirected graphs in a compact manner, using only printable ASCII characters.

Files in this format have text type and contain one line per graph.

graph6 is suitable for small graphs, or large dense graphs.

encoded graph examples:

  • petersen: IheA@GUAo
  • 30 vertices and 124 edges: GBYAcCC?JYOoq?_BgG?G@Kcig?C[cDacRBBS`DGGOMO@[A?isvUK?QOofI_SOSG_O?ahXGD??

Format reference: https://users.cecs.anu.edu.au/~bdm/data/formats.txt

Other implementations and usages:

@XVilka XVilka added the C-proposal Category: A proposal that proposes new functionality or a new direction in the crate label Nov 20, 2024
@XVilka
Copy link
Member

XVilka commented Nov 20, 2024

Could you please put more details where this format is used? Because it's unclear from the description. Worth adding this information in the commit message as well.

format for storing undirected graphs in a compact manner, using only printable ASCII characters.

files in this format have text type and contain one line per graph.

graph6 is suitable for small graphs, or large dense graphs.

encoded graph examples:
* petersen: IheA@GUAo
* 30 vertices and 124 edges: GBYAcCC?JYOoq?_BgG?G@Kcig?C[cDacRBBS`DGGOMO@[A?isvUK?QOofI_SOSG_O?ahXGD??

format reference: https://users.cecs.anu.edu.au/~bdm/data/formats.txt

other implementations and usages:
* networkX: https://networkx.org/documentation/stable/reference/readwrite/sparsegraph6.html
* Wolfram: https://reference.wolfram.com/language/ref/format/Graph6.html.en
* SageMath: https://doc.sagemath.org/html/en/reference/graphs/sage/graphs/graph.html#sage.graphs.graph.Graph.graph6_string
* nauty tool: https://pallini.di.uniroma1.it/
limit indexmap version since its latest release broke petgraph MSRV
@BryanCruz
Copy link
Contributor Author

hi @XVilka, thanks for the follow up on this

updated both the commit message and the PR description

@XVilka XVilka merged commit 17511c0 into petgraph:master Nov 24, 2024
6 checks passed
@@ -35,7 +35,7 @@ debug = true

[dependencies]
fixedbitset = { version = "0.4.0", default-features = false }
indexmap = "2.0"
indexmap = "~2.5.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

Please don't do this! It prevents users with more current compilers from using the latest petgraph and indexmap together, even though they would otherwise work fine.

A better way is to downgrade it just for your MSRV CI, either manually with cargo update --precise or using Rust 1.84's new resolver (in beta) before running the test with your actual MSRV.

Copy link

Choose a reason for hiding this comment

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

I also just hit this, since I have another dependency that specifies indexmap = "2.7".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-proposal Category: A proposal that proposes new functionality or a new direction in the crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants