Aalto-LeTech / jsav-exercise-recorder

Records students' solutions to JSAV-based visual algorithm simulation exercises
0 stars 2 forks source link

Scaffolded Prim: remove need to process nodes in alphabetic order #253

Closed ttaiv closed 3 weeks ago

ttaiv commented 3 months ago

Problem

The current version of Prim exercise (PrimAVPE-scaffolded-v2) does not usually require to process the neighbors of a node in alphabetic order. However, when two edges connecting the previously dequeued node to unvisited nodes happen to have the same weight, it is required to process them in alphabetic order to satisfy the grader. Screenshot from 2024-06-07 14-54-26 Example: Here it is required to first enqueue K to satisfy the grader.

Solution (edited)

Just add adjacency list representation of the graph --> emphasizes that the algorithm is deterministic and makes it clear what determines the processing order of the nodes. NOTE: the grading should now also be modified to require processing nodes in the order specified by adjacency list.

ttaiv commented 3 months ago

Unfortunately, it seems that the proposed solution is not sufficient to remove the need for alphabetic order. For example in this situation: Screenshot from 2024-06-18 11-14-11

Enqueuing M, then N and pressing dequeue results to:

Screenshot from 2024-06-18 11-14-40

That is, N is the highest priority element.

On the other hand, enqueuing first N, then M and pressing dequeue result to:

Screenshot from 2024-06-18 11-15-05

That is, F being the highest priority element.

Possible solutions

atilante commented 3 months ago

An excellent finding! My comments on possible solutions:

Solution 1. Unique edge weights Pros:

Cons:

Solution 2. Revert back to alphabetic order in priority queue Pros:

Solution 3. Modify grading to create multiple model answers. Pros:

Cons:

Solution 4. Keep the alphabetic order requirement Pros:

Cons:

Comment:

Considering the options, I would choose Solution 2, unless Archie would like to have Solution 4 to emphasize the neighbour list.

atilante commented 2 months ago

Archie's comments:

Solution 1 is nasty, not recommended. Proposal 1: ensure that there are two edges with the same weight, but not three. Proposal 2: ban solutions which are not deterministic. Combine Proposal 1 and Proposal 2.

Solution 3: more programming work. Then one should choose the correct model answer version to be displayed.

Archie would prefer #213 because it make the exercise more deterministic. Then also switch back from the alphabet-agnostic grader to the default JSAV grader. Then, if the student enqueues neighbors to the priority queue in other order than what is in the neighbour list, the step is graded as incorrect. The idea is to show the student that the solution is different depending on the enqueuing order.