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

TropicalGeometry: tropical linear spaces from graphs #4445

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions docs/src/TropicalGeometry/linear_space.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ In addition to converting from `TropicalVariety`, objects of type `TropicalLinea
4. matrices over a field and a tropical semiring map.
- if matrix over `QQ` and tropical semiring map is trivial, uses an implementation of Rincon's algorithm [Rin13](@cite) in `polymake`
- for general input, computes minors and uses constructor (2.)
5. graphs
```@docs
tropical_linear_space
```
Expand Down
24 changes: 24 additions & 0 deletions src/TropicalGeometry/linear_space.jl
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,30 @@ function tropical_linear_space(I::MPolyIdeal, nu::Union{Nothing,TropicalSemiring
end


@doc raw"""
tropical_linear_space(G::Graph, nu::TropicalSemiringMap; weighted_polyhedral_complex_only::Bool=false)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
tropical_linear_space(G::Graph, nu::TropicalSemiringMap; weighted_polyhedral_complex_only::Bool=false)
tropical_linear_space(G::Graph[, nu::TropicalSemiringMap]; weighted_polyhedral_complex_only::Bool=false)

Maybe mention that this is optional (and what it defaults to)?


Return the Bergman fan of the graphic matroid of `G` as a tropical linear space, the tropical semiring map `nu` is used to fix the convention. If `weighted_polyhedral_complex_only` is true, will not cache any extra information.

# Examples
```jldoctest
julia> G = complete_graph(4)
Undirected graph with 4 nodes and the following edges:
(2, 1)(3, 1)(3, 2)(4, 1)(4, 2)(4, 3)

julia> tropical_linear_space(G)
Min tropical linear space

```
"""
function tropical_linear_space(G::Graph, nu::Union{Nothing,TropicalSemiringMap}=nothing; weighted_polyhedral_complex_only::Bool=false)
M = matrix(QQ,signed_incidence_matrix(G))
TropG = tropical_linear_space(M,nu;weighted_polyhedral_complex_only=weighted_polyhedral_complex_only)
if !weighted_polyhedral_complex_only
set_attribute!(TropG,:graph,G)
end
return TropG
end

###############################################################################
#
Expand Down
6 changes: 6 additions & 0 deletions test/TropicalGeometry/linear_space.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,10 @@
@test issetequal(plueckerVector,tropical_pluecker_vector(TropL))
end

@testset "tropical linear space from graphs" begin
G = complete_graph(3)
TropG = tropical_linear_space(G)
@test f_vector(TropG) == [0,1,3]
end

end
Loading