Quiz 2

Graph Algorithms

94 words
1 min read
Python Week 1: the first filter for runtime behavior
Visual companion
Python
Type and operator map

Python Week 1: the first filter for runtime behavior

View
Revision summary

What this note is really saying

Short form

# Graph Algorithms ## BFS (Breadth-First Search) ## DFS (Depth-First Search) ## Dijkstra's Shortest Path Complexity: $O(V \log V + E)$ with binary heap. [Join Discord](https://discord.gg/gE2m4Qrdqv) [Previous**Eulerian & Hamiltonian**](/notes/04-degree-electives-bsma3001-discrete-mathematics-week07-07-euler-hamilton...

Graph Algorithms

python
from collections import deque
def bfs(graph, start):
    visited = set()
    queue = deque([start])
    visited.add(start)
    while queue:
        v = queue.popleft()
        for neighbor in graph[v]:
            if neighbor not in visited:
                visited.add(neighbor)
                queue.append(neighbor)
    return visited
python
def dfs(graph, start, visited=None):
    if visited is None:
        visited = set()
    visited.add(start)
    for neighbor in graph[start]:
        if neighbor not in visited:
            dfs(graph, neighbor, visited)
    return visited

Dijkstra's Shortest Path

Complexity: O(VlogV+E)O(V \log V + E) with binary heap. Join Discord PreviousEulerian & HamiltonianNextNumber Theory & RSA
Document outline

Keep your place and jump directly to a heading.

Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.