Aalto-LeTech / jsav-exercise-recorder

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

BFS: visual queue interface #249

Open atilante opened 5 months ago

atilante commented 5 months ago

Related to generic idea in #240 : create a new version of Breadth-first Search exercise where the student simulates the queue.

This issue would extend #128. This issue requires #211 and #214.

The generic idea is the same as in DijkstraPE-scaffolded-v3:

  1. Each vertex belongs to one of the three sets: Unknown, Fringe, Spanning Tree.
  2. Each edge belongs to one of the three sets: Unknown, Fringe, Spanning Tree.
  3. The start vertex is in the Spanning tree initially.
  4. All other vertices and edges are Unknown initially.
  5. Clicking an edge (u,v) should cause the following: 2.1. Assume u is the recently dequeued node, while v is Unknown. 2.2. Transfer (u,v) from Unknown to Fringe. 2.3. Transfer v from Unknown to Fringe. 2.4. Enqueue (u,v).
  6. Clicking a Dequeue button should cause the following: 6.1. Edge (u,v) is dequeued. 6.2. Transfer (u,v) from Fringe to Spanning Tree. 6.3. Transfer v from Fringe to Spanning Tree.

However, Prim-PQ and Dijkstra-PQ allow the student to make mistakes: the assumption in step 2.1 above might not be true. Refer to the program code of those exercises to how the exercise behaves with incorrect steps.