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

Find invalid entries in homs #62

Merged
merged 9 commits into from
Oct 3, 2023

Conversation

slwu89
Copy link
Member

@slwu89 slwu89 commented Oct 1, 2023

Address #57 by defining a new function undefined_subparts which, given a hom, finds for what parts in the domain it is undefined. The most common use is after calling rem_parts! on an object, homs with that object as a codomain will have undefined values and we'd like to find them.

This function is only defined for homs whose domain object is <: DenseParts, because when rem_parts! is used on <: MarkAsDeleted, only out-homs are deleted, so given an in-hom it won't be possible to recover the indices of parts "incident" to the undefined value. Example in code below:

julia> MySch = BasicSchema(
           [:A,:B], [(:f,:A,:B)], [], []
       )
BasicSchema{Symbol}([:A, :B], [(:f, :A, :B)], Symbol[], Tuple{Symbol, Symbol, Symbol}[])

julia> @acset_type MyDataNoIdxBit(MySch, part_type=BitSetParts)
MyDataNoIdxBit

julia> data = @acset MyDataNoIdxBit begin
           A = 5
           B = 5
           f = [1,2,3,4,5]
       end
MyDataNoIdxBit {A:5, B:5}
┌───┬───┐
│ A │ f │
├───┼───┤
│ 11 │
│ 22 │
│ 33 │
│ 44 │
│ 55 │
└───┴───┘


julia> rem_parts!(data, :B, 1:3)


julia> data
MyDataNoIdxBit {A:5, B:2}
┌───┬───┐
│ A │ f │
├───┼───┤
│ 11 │
│ 22 │
│ 33 │
│ 44 │
│ 55 │
└───┴───┘


julia> data.subparts[:f]
ACSets.ColumnImplementations.DenseFinColumn{Vector{Int64}}(ACSets.Mappings.VecMap(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5), ACSets.PreimageCaches.TrivialCache{Int64, Int64}())

@slwu89 slwu89 requested a review from kris-brown October 1, 2023 19:30
@codecov
Copy link

codecov bot commented Oct 1, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (e2739a9) 90.04% compared to head (6fe42eb) 90.48%.
Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #62      +/-   ##
==========================================
+ Coverage   90.04%   90.48%   +0.44%     
==========================================
  Files          12       14       +2     
  Lines        1085     1146      +61     
==========================================
+ Hits          977     1037      +60     
- Misses        108      109       +1     
Files Coverage Δ
src/ACSetInterface.jl 90.26% <100.00%> (+0.08%) ⬆️
src/DenseACSets.jl 89.39% <100.00%> (+0.22%) ⬆️

... and 5 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/DenseACSets.jl Outdated Show resolved Hide resolved
src/DenseACSets.jl Outdated Show resolved Hide resolved
test/ACSets.jl Outdated Show resolved Hide resolved
@epatters epatters added the enhancement New feature or request label Oct 2, 2023
@slwu89 slwu89 requested a review from kris-brown October 3, 2023 00:56
@slwu89
Copy link
Member Author

slwu89 commented Oct 3, 2023

Thanks @kris-brown for the review! I've addressed your comments, and now the undefined_subparts method works for acsets with either <:DenseParts or <:MarkAsDeleted implementation of parts ids.

src/DenseACSets.jl Outdated Show resolved Hide resolved
@slwu89 slwu89 requested a review from kris-brown October 3, 2023 14:58
@kris-brown
Copy link
Collaborator

Thanks @slwu89, this looks good to merge in once you add an extra test line for parts_type!

@kris-brown kris-brown linked an issue Oct 3, 2023 that may be closed by this pull request
@slwu89
Copy link
Member Author

slwu89 commented Oct 3, 2023

Thanks @kris-brown! Tests for parts_type added in 6fe42eb

@kris-brown kris-brown merged commit a058764 into AlgebraicJulia:main Oct 3, 2023
9 checks passed
@slwu89 slwu89 deleted the find-undefined branch October 3, 2023 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

incident with invalid entries
3 participants