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

Durham Workshop 2024 (Yue's group) #4328

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from
12 changes: 12 additions & 0 deletions docs/oscar_references.bib
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
@article{BE91,
title = {Graph Curves},
author = {Bayer, Dave and Eisenbud, David},
year = {1991},
month = mar,
journal = {Advances in Mathematics},
volume = {86},
number = {1},
pages = {1--40},
issn = {0001-8708},
doi = {10.1016/0001-8708(91)90034-5},
}

@Article{ABGJ18,
author = {Allamigeon, Xavier and Benchimol, Pascal and Gaubert, Stéphane and Joswig, Michael},
Expand Down
1 change: 1 addition & 0 deletions docs/src/AlgebraicGeometry/Curves/ProjectiveCurves.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ CurrentModule = Oscar
ProjectiveCurve
invert_birational_map
geometric_genus
graph_curve
```
1 change: 1 addition & 0 deletions docs/src/PolyhedralGeometry/Polyhedra/constructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ rss_associahedron
signed_permutahedron
stable_set_polytope
transportation_polytope
tutte_lifting
zonotope
zonotope_vertices_fukuda_matrix
```
Expand Down
1 change: 1 addition & 0 deletions docs/src/PolyhedralGeometry/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ Lower dimensional polyhedral objects can be visualized through polymake's backen

```@docs
visualize(P::Union{Polyhedron{<:Union{Float64,FieldElem}}, Cone{<:Union{Float64,FieldElem}}, PolyhedralFan{<:Union{Float64,FieldElem}}, PolyhedralComplex{<:Union{Float64,FieldElem}}, SubdivisionOfPoints{<:Union{Float64,FieldElem}}, Graph, SimplicialComplex}; kwargs...)
visualize(::Vector)
```


Expand Down
59 changes: 59 additions & 0 deletions src/AlgebraicGeometry/Curves/ProjectiveCurve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,62 @@ end
################################################################################
# The union of two curves is a curve
Base.union(C::T, D::T) where T <: AbsProjectiveCurve = ProjectiveCurve(union(underlying_scheme(C),underlying_scheme(D)))



function edge_matrix(G::Graph)
M = zero_matrix(ZZ, nv(G), ne(G))
for (i,e) in enumerate(edges(G))
M[src(e),i] = 1
M[dst(e),i] = -1
end
return M
end
YueRen marked this conversation as resolved.
Show resolved Hide resolved

@doc raw"""
graph_curve(G::Graph)

Return the graph curve of `G`, i.e., a union of lines whose dual graph is `G`, see [BE91](@cite).

Assumes that `G` is trivalent and 3-connected.

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

julia> C1 = graph_curve(G1)
Projective curve
in projective 2-space over QQ with coordinates [x1, x2, x3]
defined by ideal (x1^2*x2*x3 - x1*x2^2*x3 + x1*x2*x3^2)

julia> G2 = edgegraph(cube(3))
Undirected graph with 8 nodes and the following edges:
(2, 1)(3, 1)(4, 2)(4, 3)(5, 1)(6, 2)(6, 5)(7, 3)(7, 5)(8, 4)(8, 6)(8, 7)

julia> C2 = graph_curve(G2)
Projective curve
in projective 4-space over QQ with coordinates [x1, x2, x3, x4, x5]
defined by ideal with 5 generators

```
"""
function graph_curve(G::Graph; check::Bool=true)
if check
@req all(isequal(3),degree(G)) "G is not trivalent"
end

R,_ = graded_polynomial_ring(QQ,Int(nv(G)//2+1))
EG = kernel(Oscar.edge_matrix(G);side=:right)

edgesG = Vector{Int}.(collect(edges(G)))
lineIdeals = MPolyIdeal[]
for v in vertices(G)
EGv = matrix(R,EG[findall(edge->(v in edge),edgesG),:])
push!(lineIdeals,ideal(minors(vcat(EGv,matrix(R,[gens(R)])),3)))
end
graphCurveIdeal = reduce(intersect,lineIdeals)

return projective_curve(graphCurveIdeal)
end
37 changes: 37 additions & 0 deletions src/PolyhedralGeometry/Polyhedron/standard_constructions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2455,3 +2455,40 @@ function vertex_figure(P::Polyhedron{T}, n::Int; cutoff=nothing) where {T<:scala
Polymake.polytope.vertex_figure(pm_object(P), n - 1; opts...), coefficient_field(P)
)
end

@doc raw"""
tutte_lifting(G::Graph{Undirected})

Compute a realization of `G` in $\mathbb{R}^3$, i.e., a polyhedron whose edge graph is `G`. Assumes that `G` is planar, 3-connected, and that is has a triangular facet.

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

julia> pG = tutte_lifting(G)
Polytope in ambient dimension 3

julia> vertices(pG)
4-element SubObjectIterator{PointVector{QQFieldElem}}:
[0, 0, 0]
[1, 0, 1//3]
[0, 1, 0]
[1//3, 1//3, 0]

julia> faces(IncidenceMatrix,pG,1)
6×4 IncidenceMatrix
[1, 2]
[1, 3]
[1, 4]
[2, 3]
[2, 4]
[3, 4]

```
"""
function tutte_lifting(G::Graph{Undirected})
pmG = Polymake.graph.Graph{Undirected}(; ADJACENCY=G)
return polyhedron(Polymake.polytope.tutte_lifting(pmG))
end
21 changes: 21 additions & 0 deletions src/PolyhedralGeometry/visualization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,27 @@ function visualize(
Polymake.visual(pmo; kwargs...)
end

@doc raw"""
visualize(P::Vector; kwargs...)

Visualize a vector of polyhedral objects `P`, i.e., all polyhedral objects in `P` in one visualization. See [`visualize`](@ref Oscar.visualize(::Union{SimplicialComplex, Cone{<:Union{Float64, FieldElem}}, Graph, PolyhedralComplex{<:Union{Float64, FieldElem}}, PolyhedralFan{<:Union{Float64, FieldElem}}, Polyhedron, SubdivisionOfPoints{<:Union{Float64, FieldElem}}})) for which polyhedral objects and keyword arguments are possible.

# Examples
```julia
julia> p = simplex(3)
Polytope in ambient dimension 3

julia> P = [p,p+[3,0,0],p+[0,3,0],p+[0,0,3]]
4-element Vector{Polyhedron{QQFieldElem}}:
Polytope in ambient dimension 3
Polytope in ambient dimension 3
Polytope in ambient dimension 3
Polytope in ambient dimension 3

julia> visualize(P)

```
"""
function visualize(P::Vector; kwargs::Dict=Dict{Int,Nothing}())
for p in P
@req p isa visual_supported_types "Can not visualize objects of type $(typeof(P))"
Expand Down
2 changes: 2 additions & 0 deletions src/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,7 @@ export graded_map
export graded_polynomial_ring
export grading_group
export graph
export graph_curve
export graph_from_adjacency_matrix
export graph_from_edges
export grassmann_pluecker_ideal
Expand Down Expand Up @@ -1566,6 +1567,7 @@ export tropical_variety
export truncate
export turn_denominator_into_polyhedron
export tutte_connectivity
export tutte_lifting
export tutte_polynomial
export twist
export twisting_sheaf
Expand Down
Loading