Graphs
When is an edge incident?
When it is on the two vertices it connects
When are two vertices adjacent (or neighbors)?
When they are connected by an edge
cycle
path with the first and last node equal
Directed graph
A graph in which the edges have direction
DAG
directed acyclic graph
topological sort
listing of nodes such that if (a,b) is an edge, a appears before b in the list
Do the nodes in graphs have to be hierarchical?
No
complete graph
a graph in which all nodes are adjacent
precedence graph
a graph in which an edge from x to y indicates x should come before y (is a DAG)
weighted graph
a graph in which the edges have a weight
graph
a set of nodes connected by edges
simple path
all nodes are distinct
depth-first search
builds a spanning tree of all of the reachable nodes from the staring vertex v, using marking of the visited nodes
acyclic graph
graph without cycles
adjacency matrix
matrix with entries that indicate if an edge between two vertices is present (in a weighted graph entries are the weights)
topological sort algorithm
modification of DFS, traverse tree using DFS starting from all nodes that have no predecessor, add a node to the list when ready to backtrack
path
sequence of nodes that are connected to each other
path length
the number of edges in the path, or the sum of weights
in-degree of a vertex
the number of edges pointing into the vertex
out-degree of a vertex
the number of edges pointing out of the vertex
breadth-first search
visits the nodes of a graph in breadth-first order, results in a spanning tree