
Directed Graphs - Princeton University
Jan 14, 2020 · A directed graph (or digraph) is a set of vertices and a collection of directed edges that each connects an ordered pair of vertices. We say that a directed edge points from the first vertex in …
4. Graphs - Princeton University
Aug 26, 2016 · 4.1 Undirected Graphs introduces the graph data type, including depth-first search and breadth-first search. 4.2 Directed Graphs introduces the digraph data type, including topological sort …
Shortest Paths - Princeton University
Jan 10, 2025 · A negative cycle is a directed cycle whose total weight (sum of the weights of its edges) is negative. The concept of a shortest path is meaningless if there is a negative cycle.
Depth-first search in digraphs Same method as for undirected graphs. ・Every undirected graph is a digraph (with edges in both directions).・DFS is a digraph algorithm. DFS (to visit a vertex v) Mark v …
Undirected Graphs - Princeton University
Apr 16, 2019 · A bridge in a graph is an edge that, if removed, would separate a connected graph into two disjoint subgraphs. A graph that has no bridges is said to be two-edge connected.
Digraph.java - Princeton University
Oct 29, 2025 · Below is the syntax highlighted version of Digraph.java from §4.2 Directed Graphs.
Minimum Spanning Trees - Princeton University
Jan 10, 2025 · An edge-weighted graph is a graph where we associate weights or costs with each edge. A minimum spanning tree (MST) of an edge-weighted graph is a spanning tree whose weight (the …
Digraph (Algorithms 4/e) - Princeton University
The Digraph class represents a directed graph of vertices named 0 through V - 1. It supports the following two primary operations: add an edge to the digraph, iterate over all of the vertices adjacent …
6.4 Maximum Flow - Princeton University
Jun 14, 2017 · Given an undirected graph and two vertices s and t, find a simple cycle containing both s and t (or report that no such cycle exists). Hint: there is a directed cycle containing both s and t if and …
DirectedDFS.java - Princeton University
Oct 29, 2025 · Below is the syntax highlighted version of DirectedDFS.java from §4.2 Directed Graphs.