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

Use Julia process API to interact with nauty #68

Merged
merged 2 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ XLSX = "fdbf4ff8-1666-58a4-91e7-1b58723a45e0"
nauty_jll = "55c6dc9b-343a-50ca-8ff2-b71adb3733d5"

[extensions]
ACSetsnauty_jllExt = "nauty_jll"
ExcelACSets = "XLSX"
NautyACSetsExt = "nauty_jll"

[compat]
CompTime = "0.1"
Expand Down
22 changes: 0 additions & 22 deletions ext/ACSetsnauty_jllExt.jl

This file was deleted.

22 changes: 22 additions & 0 deletions ext/NautyACSetsExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module NautyACSetsExt

using ACSets
using nauty_jll

"""Compute CSetNautyRes from an ACSet."""
function ACSets.call_nauty(g::ACSet)::CSetNautyRes
ACSets.NautyInterface.parse_res(nauty_res(g), g)
end

"""Make shell command to dreadnaut (nauty) and collect stdout text."""
function nauty_res(g::ACSet)::AbstractString
isempty(g) && return NautyRes(g)
all(o -> nparts(g, o) == 0, attrtypes(acset_schema(g))) ||
error("Nauty integration with VarACSets not yet supported")
process = open(`$(nauty_jll.dreadnaut_path)`, write=true, read=true)
print(process, ACSets.NautyInterface.dreadnaut(g))
close(process.in)
read(process, String)
end

end # module