5 typical operations of graphs as ADT
3 data structures graphs can be based on
describe adjacency matrix implementation
how are the matrixes implemented
2-d arrays
space efficiency of adjacency lists
theta(n + m)
space efficiency of adjacency matrix
theta(n^2)
space efficiency of incidence lists
theta(nm)
big theta of determining whether there is an edge between 2 given vertices for adjacency lists
deg(v)
big theta of determining whether there is an edge between 2 given vertices for adjacency matrix
1
big theta of determining whether there is an edge between 2 given vertices for incidence matrix
m
big theta to identify all edges in an adjacency list
n + m
big theta to identify all edges in an adjacency matrix
n^2
big theta to identify all edges in an incidence matrix
nm
big theta to find all vertices adjacent to a given vertex in an adjacency list
deg(v)
big theta to find all vertices adjacent to a given vertex in an adjacency matrix
n
big theta to find all vertices adjacent to a given vertex in an incidence list
m + ndeg(v)
2 types of graph traversal algorithms
describe DFS
outputs of DFS
big theta of depth-first search
n + m
big theta of DFS on an adjacency matrix
n^2
describe BFS
big theta of BFS
n + m
big theta of BFS as an adjacency matrix
n^2