Graph Theory & Networks Lab
Build graphs by clicking to add nodes and edges. Run breadth-first and depth-first traversals, find shortest paths with Dijkstra's algorithm, and compute minimum spanning trees with Kruskal's algorithm. Detect Euler paths and analyze graph properties.
Guided Experiment: BFS vs DFS
How does the traversal order differ between BFS and DFS on the same graph? Which explores nearby nodes first?
Write your hypothesis in the Lab Report panel, then click Next.
Controls
Click the canvas to add nodes. Click a node, then another node to add an edge.
Graph Properties
Data Table
(0 rows)| # | Graph | Nodes | Edges | Connected | Eulerian | Density |
|---|
Reference Guide
BFS vs DFS
Breadth-first search (BFS) explores all neighbors before going deeper, using a queue. Depth-first search (DFS) goes as deep as possible first, using a stack.
BFS finds shortest paths in unweighted graphs. DFS is useful for detecting cycles and topological sorting.
Dijkstra's Algorithm
Dijkstra's algorithm finds the shortest path from a source to all other nodes in a weighted graph with non-negative edges.
It greedily selects the unvisited node with smallest tentative distance, then relaxes all its neighbors.
Minimum Spanning Tree
A minimum spanning tree (MST) connects all nodes with the minimum total edge weight. Kruskal's algorithm sorts edges by weight and adds them if they do not create a cycle.
MSTs are used in network design, clustering, and approximation algorithms.
Euler Paths & Circuits
An Euler circuit traverses every edge exactly once and returns to the start. An Euler path traverses every edge exactly once but may end at a different vertex.
A connected graph has an Euler circuit if and only if every vertex has even degree.