9.1 (Graphs) Flashcards
What is a collection of dots and lines?
graph
What are the dots in a graph called?
vertices (nodes)
What are the lines in a graph called?
edges
Each edge connects a pair of ________.
vertices
There is at most ____ edge between any two vertices
1
What is an edge that only goes in one direction?
directed edge
What is an edge that can go in both directions?
undirected edge
What is a path that begins and ends at the same node?
cycle
What is a graph that doesn’t contain any cycles?
acyclic graph
What is a graph that’s connected if every node is reachable from every other node?
connected graph
What is a graph that’s complete if every node has an edge to every other edge? (grows as O(n^2)
complete graph
A node is reachable only if?
a path exists between the two nodes
Vertices that are all connected to a vertex with an edge are called?
neighbors
A graph is considered _______ if it has numbers associated with edges
weighted
What are weighted graphs useful for?
mapping between locations, traffic, distance, time, etc.
Mathematically, a graph G is a pair (___, ___)
(V, E)
V is the set of _______.
vertices
E is the set of _______.
edges
A graph is _____ if it has relatively few edges
sparse
A graph is ______ if it has a lot of edges
dense
Which graph algorithm explores a graph level-by-level using a queue?
Breadth-First-Search
Which graph algorithm explores as deeply as possible using a stack (or recursion)?
Depth-First-Search
Which graph algorithm is useful for finding the shortest path between points in weighted graphs?
Dijkstra
What is Breadth-First-Search useful for?
finding the shortest path in unweighted graphs