Tutorial

Table of Contents

Running the Algorithms

The sandbox is an interactable and customizable tool designed as an educational look for routing algorithms. The two algorithms provide are

Initiating the Algorithm

To get started, simply click the "Run Dijkstra" button or the "Run Bellman-Ford" button to run each respective algorithm.

Algorithm Buttons

After you clicked either button, depending on the algorithm you selected, either one or two pop-up boxes will appear asking for information.

If you chose Djikstra's algorithm, then two pop-ups will appear, asking for the start and end node respectively:

Start Node Pop-up
End Node Pop-up

Otherwise if you choose Bellman-Ford's algorithm, then it will only ask for the start node. Please enter an integer corresponding to the node number on the sandbox. You can also type "N5" for example for Node number 5, but just 5 will do. Indexes start at 0.

Node as it Appears on the Sandbox

Traversing Through the Algorithm

Once you have entered the input information (correctly I hope), The sandbox will enter animation mode, which will visually display the chosen algorithm step by step. To facilitate this use the animation control buttons that will appear once the sanbox is put in animation mode.

Animation Control Buttons

You should now also see a table appear under the "Algorithm Tracker section" which details the current trace of the selected algorithm.

Alogrithm Tracker Table Upon Start of Bellman-Ford Algorithm

By pressing the "Step" button, it will proceed one step in the chosen algorithm, updating the table and also providing a visual representation in the sandbox.

Alogrithm Tracker Table After One Step of Bellman-Ford Algorithm
Sandbox After One Step of Bellman-Ford Algorithm. Note the Highlighted Edge

Wrapping-Up the Algorithm

You can continue to press the "Step" button to go through the chosen algorithm until it finishes. By then, the sandbox will show the result of the algorithm and the table will be completed. You can then press the "Exit Animation" button to leave animation mode and return back to edit mode.

Sandbox After Completion of the Bellman-Ford Algorithm. The Cost of Each Node from the Start Node is Displayed
Sandbox After Completion of Dijkstra's Algorithm. The Optimal Path from the Start Node to the End Node is Highlighted in Gold

Once animation mode is exited, you can edit the network and run another algorithm. Have fun!

Editing the Network

By default, there will be a pre-made network made for you when you load the page, but it's called a "sandbox" for a reason.

Clearing the Network

Press the "Clear" button to wipe the network

Clear Button

Node Creation

To add a node to the network, simply click any where in the network editor

Node Creation

You can also drag nodes anywhere on the network editor

Node Dragging

Edge Creation

To create an edge, click the "Add Edge" Button. You will be prompted for the start and end node of the edge. Please enter an integer corresponding to the node number on the sandbox. You can also type "N5" for example for Node number 5, but just 5 will do. Indexes start at 0. A third pop-up will also appear for the edge cost. Please enter an integer. Note that the order of the start and end nodes do not matter since the network is bidirectional.

Add Edge Button
Edge Creation

Random Network Creation

If you are not feeling creative, you can also press the "Randomize button to generate a network for you. Note you can still edit a generated network however you want.

Randomize Button
Randomly Generated Network

Undo-ing

To undo any action (adding a node, dragging a node, adding an edge, clearing the network, generating a random network) simply press the "Undo" button OR press Ctrl + Z on your keyboard

Undo Button

Now that you've learned how to use the tool, go to our Sandbox page to try it out yourself.