Graph Algorithms Flashcards
What are the 2 sets of graphs
V, set of vertices/nodes
E, set of edges/links
What is the degree of a vertex
The number of edges connected to it
What are digraphs
Directed graphs, edges are pointed
What is a simple path
All nodes are distinct
What is the sum of weights of paths called
Path cost
What is a graph without cycles called
Directed Acyclic Graph (DAG)
What is a connected graph
every node has a way to get to every other node
what is a complete graph
every single node is connected
what is a graph that has lots of edges vs few edges called
dense vs sparse
What is the 2D array representing a graph called
Adjacency Matrix
Can topological sorts have multiple answers
yes
What kind of graph are topological sorts for
DAGs
What is the topological sort algorithm
List the in-degree for all nodes and softly delete each node with 0 in-degree while decrementing what it is pointing, repeat
What is the time complexity of topological sort using a list
O(V^2)
What is the time complexity of topological sorting using a queue
O(E+V)