Skip to content

Add graph_curve(::Graph)#4452

Merged
fingolfin merged 5 commits intomasterfrom
yr/graphCurve
Feb 26, 2025
Merged

Add graph_curve(::Graph)#4452
fingolfin merged 5 commits intomasterfrom
yr/graphCurve

Conversation

@YueRen
Copy link
Copy Markdown
Member

@YueRen YueRen commented Jan 11, 2025

The final pull request of the Durham Workshop. Requires #4450, so I will rebase + undraft it once #4450 is merged.

@YueRen YueRen marked this pull request as draft January 11, 2025 12:43
Comment thread docs/oscar_references.bib Outdated
@YueRen YueRen force-pushed the yr/graphCurve branch 3 times, most recently from 8477178 to 181aca5 Compare January 13, 2025 11:48
@YueRen YueRen marked this pull request as ready for review January 13, 2025 11:52
@YueRen
Copy link
Copy Markdown
Member Author

YueRen commented Jan 13, 2025

I've rebased the changes now that #4450 is merged.

@benlorenz: I also had to add an Base.keys(::EdgeIterator) to the combinatorics part to make edges(::Graph) work with findall, e.g.,

G = vertex_edge_graph(simplex(3))
findall(edge->(1 in edge),edges(G))

Let me know if there are any objections. (I normally try to have separate pull-requests for separate areas, but was too lazy to make this one-line change)

@benlorenz
Copy link
Copy Markdown
Member

Adding keys would imply that eit[i] should work but that is not the case and would be difficult to make work. Also the length (and thus the new keys function) will change during iteration since the EdgeIterator is stateful.

julia> eit = edges(g)
Oscar.EdgeIterator(Polymake.LibPolymake.GraphEdgeIteratorAllocated{Undirected}(Ptr{Nothing} @0x000000003f407670), 6)

julia> length(eit)
6

julia> iterate(eit)
(Edge(2, 1), 2)

julia> iterate(eit)
(Edge(3, 1), 2)

julia> length(eit)
4

julia> collect(eit)
4-element Vector{Edge}:
 Edge(3, 2)
 Edge(4, 1)
 Edge(4, 2)
 Edge(4, 3)

@YueRen
Copy link
Copy Markdown
Member Author

YueRen commented Jan 13, 2025

Adding keys would imply that eit[i] should work but that is not the case and would be difficult to make work. Also the length (and thus the new keys function) will change during iteration since the EdgeIterator is stateful.

Okay, I will remove Base.keys(::EdgeIterators) then and use collect(edges(G)) in findall.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.41%. Comparing base (7219bae) to head (50280d3).
Report is 97 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4452   +/-   ##
=======================================
  Coverage   84.41%   84.41%           
=======================================
  Files         668      669    +1     
  Lines       88441    88457   +16     
=======================================
+ Hits        74656    74672   +16     
  Misses      13785    13785           
Files with missing lines Coverage Δ
src/AlgebraicGeometry/Curves/GraphCurve.jl 100.00% <100.00%> (ø)

@joschmitt
Copy link
Copy Markdown
Member

This seems to be ready for review since a month. Maybe the triage meeting can discuss who can review it.

@fingolfin
Copy link
Copy Markdown
Member

Perhaps @wdecker or @simonbrandhorst or @afkafkafk13 or @HechtiDerLachs or @ederc could review this?

Copy link
Copy Markdown
Collaborator

@afkafkafk13 afkafkafk13 left a comment

Choose a reason for hiding this comment

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

Looks fine.

I left you one comment on the docstring. Feel free to ignore it, if the example is printed the way you want it.

Comment on lines +23 to +27
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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The automatic suppression of the equations in printing makes the second example lack a bit of 'content'...

If you would like to have it for testing reasons, please put it in the tests instead and test for correctness of the curve. If you consider the information as vital for users, please print at least one of the equations.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good point, I will adjust the docstring accordingly.

Comment thread src/AlgebraicGeometry/Curves/GraphCurve.jl Outdated
@joschmitt joschmitt removed the triage label Feb 20, 2025
Co-authored-by: Simon Brandhorst <brandhorst@math.uni-sb.de>
Comment thread src/AlgebraicGeometry/Curves/GraphCurve.jl Outdated
Comment thread src/AlgebraicGeometry/Curves/GraphCurve.jl Outdated
cycleMatrix = matrix(R,cycleMatrix) # converting to matrix over R for vcat below

vertexIdeals = MPolyIdeal[]
for v in 1:n_vertices(G)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't this be like so? (Not sure if it ever matters... maybe for subgraphs...? Perhaps @lkastner can clarify?)

Suggested change
for v in 1:n_vertices(G)
for v in vertices(G)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@fingolfin Because of the following: #4426

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Once #4633 is merged, this can (and should) be adapted

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for clarifying

YueRen and others added 2 commits February 21, 2025 14:31
Co-authored-by: Max Horn <max@quendi.de>
Co-authored-by: Max Horn <max@quendi.de>
Comment thread src/AlgebraicGeometry/Curves/GraphCurve.jl Outdated
@fingolfin fingolfin merged commit 50f5fcc into master Feb 26, 2025
@fingolfin fingolfin deleted the yr/graphCurve branch February 26, 2025 16:41
@fingolfin fingolfin changed the title AlgebraicGeometry: added graph_curve(::Graph) Add graph_curve(::Graph) Feb 27, 2025
@fingolfin fingolfin added enhancement New feature or request release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes labels Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes topic: algebraic geometry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants