Skip to content

Commit

Permalink
automorphism_group fix for rank 0 matroids + added test
Browse files Browse the repository at this point in the history
  • Loading branch information
Sequenzer committed Sep 14, 2023
1 parent ebee98c commit 07c40b0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Combinatorics/Matroids/matroids.jl
Original file line number Diff line number Diff line change
Expand Up @@ -864,4 +864,7 @@ julia> automorphism_group(M)
Group([ (3,4), (1,2), (2,3) ])
```
"""
automorphism_group(m::Matroid) = automorphism_group(IncidenceMatrix(bases(m));action=:on_cols)
function automorphism_group(m::Matroid)
length(m) > 0 || throw(ArgumentError("The matroid should not be empty."))
rank(m) < 1 ? automorphism_group(dual_matroid(m)) : automorphism_group(IncidenceMatrix(bases(m));action=:on_cols)
end
1 change: 1 addition & 0 deletions test/Combinatorics/Matroids/Matroids.jl
Original file line number Diff line number Diff line change
Expand Up @@ -343,5 +343,6 @@
@testset "matroid automorphism" begin
M = uniform_matroid(3, 5)
@test order(automorphism_group(M)) == 120
@test automorphism_group(uniform_matroid(0, 2)) == symmetric_group(2)
end
end

0 comments on commit 07c40b0

Please sign in to comment.