-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deprecate SimplicialComplex for simplicial_complex (#3234)
* deprecate SimplicialComplex for simplicial_complex * adds a test for simplicial complex for graphs * Update src/Combinatorics/SimplicialComplexes.jl Co-authored-by: Max Horn <max@quendi.de> * readd SimplicalComplex to exports * fix doc * fixed internal use of simplicial complexes to align with deprecations * transpose incidence matrix of graph * tranpose incidence matrix for graph * fixes for test * fixes dep warning * fix docs for incidence matrix * fix typo in docs * adds function for convert graph to simplicial complex * adjust use of simplicial complex in Groups test * fix in docstring --------- Co-authored-by: Max Horn <max@quendi.de>
- Loading branch information
1 parent
4b3ed0e
commit 83f513a
Showing
9 changed files
with
98 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,60 @@ | ||
@testset "SimplicialComplex" begin | ||
|
||
@testset "properties" begin | ||
|
||
sphere = SimplicialComplex([[1, 2, 3], [1, 2, 4], [1, 3, 4], [2, 3, 4]]) | ||
|
||
sphere2 = SimplicialComplex(IncidenceMatrix([[1, 2, 3], [1, 2, 4], [1, 3, 4], [2, 3, 4]])) | ||
|
||
@test sphere isa SimplicialComplex | ||
@test sphere2 isa SimplicialComplex | ||
@test vertexindices(sphere) == [1, 2, 3, 4] | ||
@test nvertices(sphere) == 4 | ||
@test facets(sphere) == Set{Int}.([[1, 3, 2], [1, 4, 2], [1, 3, 4], [3, 4, 2]]) | ||
@test facets(sphere2) == facets(sphere) | ||
@test dim(sphere) == 2 | ||
@test f_vector(sphere) == [4, 6, 4] | ||
@test h_vector(sphere) == [1, 1, 1, 1] | ||
@test betti_numbers(sphere) == [0, 0, 1] | ||
@test euler_characteristic(sphere) == 1 | ||
@test minimal_nonfaces(sphere) == [Set{Int}([1, 2, 3, 4])] | ||
R, _ = polynomial_ring(ZZ, ["a", "x", "i_7", "n"]) | ||
@test stanley_reisner_ideal(R, sphere) == ideal([R([1], [[1, 1, 1, 1]])]) | ||
@test is_isomorphic(fundamental_group(sphere), free_group()) | ||
|
||
# from #1440, make sure empty columns at the end are kept | ||
sc = SimplicialComplex([[1, 2, 4], [2, 3, 4]]) | ||
@test size(minimal_nonfaces(IncidenceMatrix, sc)) == (1, 4) | ||
end | ||
|
||
@testset "standard examples" begin | ||
|
||
for (SC, fv, bn) in ((torus(), [7, 21, 14], [0, 2, 1]), | ||
(klein_bottle(), [9, 27, 18], [0, 1, 0]), | ||
(real_projective_plane(), [6, 15, 10], [0, 0, 0]), | ||
(complex_projective_plane(), [9, 36, 84, 90, 36], [0, 0, 1, 0, 1])) | ||
|
||
@test SC isa SimplicialComplex | ||
@test f_vector(SC) == fv | ||
@test betti_numbers(SC) == bn | ||
|
||
end | ||
|
||
end | ||
|
||
@testset "torus homology" begin | ||
T = torus() | ||
H0 = homology(T, 0) | ||
H1 = homology(T, 1) | ||
H2 = homology(T, 2) | ||
@test is_trivial(H0) | ||
@test !is_trivial(H1) | ||
@test !is_trivial(H2) | ||
@test rank(H0) == 0 | ||
@test rank(H1) == 2 | ||
@test rank(H2) == 1 | ||
@testset "properties" begin | ||
|
||
sphere = simplicial_complex([[1, 2, 3], [1, 2, 4], [1, 3, 4], [2, 3, 4]]) | ||
|
||
sphere2 = simplicial_complex(IncidenceMatrix([[1, 2, 3], [1, 2, 4], [1, 3, 4], [2, 3, 4]])) | ||
|
||
@test sphere isa SimplicialComplex | ||
@test sphere2 isa SimplicialComplex | ||
@test vertexindices(sphere) == [1, 2, 3, 4] | ||
@test nvertices(sphere) == 4 | ||
@test facets(sphere) == Set{Int}.([[1, 3, 2], [1, 4, 2], [1, 3, 4], [3, 4, 2]]) | ||
@test facets(sphere2) == facets(sphere) | ||
@test dim(sphere) == 2 | ||
@test f_vector(sphere) == [4, 6, 4] | ||
@test h_vector(sphere) == [1, 1, 1, 1] | ||
@test betti_numbers(sphere) == [0, 0, 1] | ||
@test euler_characteristic(sphere) == 1 | ||
@test minimal_nonfaces(sphere) == [Set{Int}([1, 2, 3, 4])] | ||
R, _ = polynomial_ring(ZZ, ["a", "x", "i_7", "n"]) | ||
@test stanley_reisner_ideal(R, sphere) == ideal([R([1], [[1, 1, 1, 1]])]) | ||
@test is_isomorphic(fundamental_group(sphere), free_group()) | ||
|
||
# from #1440, make sure empty columns at the end are kept | ||
sc = simplicial_complex([[1, 2, 4], [2, 3, 4]]) | ||
@test size(minimal_nonfaces(IncidenceMatrix, sc)) == (1, 4) | ||
end | ||
|
||
@testset "standard examples" begin | ||
G = simplicial_complex(complete_bipartite_graph(2, 3)) | ||
for (SC, fv, bn) in ((torus(), [7, 21, 14], [0, 2, 1]), | ||
(klein_bottle(), [9, 27, 18], [0, 1, 0]), | ||
(real_projective_plane(), [6, 15, 10], [0, 0, 0]), | ||
(complex_projective_plane(), [9, 36, 84, 90, 36], [0, 0, 1, 0, 1]), | ||
(G, [5, 6], [0, 2])) | ||
|
||
|
||
@test SC isa SimplicialComplex | ||
@test f_vector(SC) == fv | ||
@test betti_numbers(SC) == bn | ||
|
||
end | ||
|
||
|
||
end | ||
|
||
@testset "torus homology" begin | ||
T = torus() | ||
H0 = homology(T, 0) | ||
H1 = homology(T, 1) | ||
H2 = homology(T, 2) | ||
@test is_trivial(H0) | ||
@test !is_trivial(H1) | ||
@test !is_trivial(H2) | ||
@test rank(H0) == 0 | ||
@test rank(H1) == 2 | ||
@test rank(H2) == 1 | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters