924 B
Adjacency list
Imagine 8 nodes with no connections
To store this data in an adjacency list we need n items to store them. We'll have 0 __e__dges however so in total our space is (n+e) == (n)
Adjacency matrix
space: O(n^2) The convention for notation btw is [x,y] meaning: * from x to y
Breadth first search
add neighbors of current to queue go through current's neighbors and add their neighbors to queue add neighbor's neighbors keep going until there are no more neighbors to add go through queue and start popping members out of the queue
Depth first search
Here we're going deeper into the neighbors
once we have a starting point
available just means that node has a non-visited neighbor if available go to a neighbor if no neighbors available visit goto 1
Kahn Sort
Graph Coloring
When figuring out how many colors we need for the graph, we should note the degree of the graph