Undirected Graph
Directed Graph
Acyclic Graph
Cyclic Graph
Disconnected Graph
Connected
Weighted Graphs
Weight: value assigned to graph edges, typically representing the cost of traveling between two vertices
B >>>>>>>> H
Best path from B to G
11
2
6
3
V
Ordered Pairs
(A, V) != (V, A)
What kind of graph would have this notation?
Unordered Pairs
{B, X} = {B, X}
What kind of graph would have this notation?
VERTEX SET
Listing Vertices
/ Edge Set / Adjacency List /
Listing Edges
Linear Data
Nonlinear Data
Linear Data Searches
Linear Search
To search from left to right.
"Let's use a for loop to find the value we're looking for"
Linear Data Searches
Binary Search
To search by comparing desired value to middle of list. Halving the list and then searching again as needed.
"Let's use a divide and conquer method to find it. This is great as long as the list is sorted!"
Non-Linear Data Searches
Depth First Search
A strategy for searching in a tree in branch order.
When to use
If the tree is very wide, a BFS might need too much memory, so it might be completely impractical. If solutions are frequent but located deep in the tree, BFS could be impractical.
Non-Linear Data Searches
Breadth First Search
A strategy for searching in a tree in level order.
When to use
If you know a solution is not far from the root of the tree, a breadth first search (BFS) might be better.
If the tree is very deep and solutions are rare, depth first search (DFS) might take an extremely long time, but BFS could be faster.