ianmackenzie / ianmackenzie/elm-triangular-mesh

Improve efficiency of edgeIndices function

Open
#1 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Elm
Stars
9
Forks
2
PR merge metrics
No merged PRs in 30d

Description

Currently a `Set ( Int, Int )` is used to track unique edges, but this involves allocating (and comparing) a lot of tuples. Instead, build up a `Set Int` where each `Int` is a packed edge index equal to

```
lowerVertexIndex * numVertices + higherVertexIndex
```
Then, once that set is constructed, use `Set.foldr` to iterate through the set, unpack each `Int` back into an `( Int, Int )` using `mod` and `//`, and accumulate these values into a list. This should maintain the property that edges are returned in sorted order with lower vertex index first and higher vertex index second.

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue identifies the edgeIndices function as the entry point; locate it in the repository and inspect its current Set (Int, Int) construction. Apply the packed-index approach described, then verify that returned edges remain sorted with the lower vertex index first and the higher vertex index second.

Written by the indexing model from the issue text.

Assessment

Tech stack
elm
Domain
computer-graphics
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.