-
Notifications
You must be signed in to change notification settings - Fork 37
Lab Exercise 1 Python
If you have the Jupyter extension installed, then you can run your code in one of three ways:
- Running the current cell
- Running the current cell, and all cells below it
- Running all cells

The output for each code cell is directly underneath, and all variables from previous code blocks, if evaluated, can be used in future code blocks as if everything was one large Python file with intermediate outputs.
To open and run the GraphTraversal.ipynb notebook, follow these steps:
-
Launch Jupyter Notebook
Open a terminal and navigate to theLab-Exercise-1/Pythondirectory. Then run:jupyter notebook
If you are running in Docker, use this command instead:
jupyter notebook --allow-root --ip=0.0.0.0
This will launch Jupyter in your default web browser.
You should see output similar to the image below in your terminal:

Click on one of the provided URLs or files to access the Jupyter interface.
-
Open the Notebook
After clicking the URL, you will see an interface similar to the one shown below:

Navigate to and click onGraphTraversal.ipynbto open the notebook. -
Run Cells
After openingGraphTraversal.ipynb, scroll down to find the code cells. You should see something similar to the image below:
To execute a code cell, either click on it and press Shift + Enter, or click the "Run" button in the toolbar at the top. -
Edit & Experiment
You can freely modify the code cells to experiment with different inputs or graph structures.
If Jupyter is not installed, you can install it via pip:
pip install notebook