
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 …
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 · Given a connected graph, design a linear-time algorithm to find a vertex whose removal (deleting the vertex and all incident edges) does not disconnect the graph.
Minimum Spanning Trees - Princeton University
Jan 10, 2025 · Given a graph with edges colored either orange or black, design a linearithmic algorithm to find a spanning tree that contains exactly k orange edges (or report that no such spanning tree …
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 …
Digraph.java - Princeton University
Oct 29, 2025 · Below is the syntax highlighted version of Digraph.java from §4.2 Directed Graphs.
Depth-first search in digraphs Same method as for undirected graphs. ・Every undirected graph is a digraph (with edges in both directions). DFS (to visit a vertex v) Mark v as visited.
Shortest Paths - Princeton University
Jan 10, 2025 · Given a weighted line-graph (undirected connected graph, all vertices of degree 2, except two endpoints which have degree 1), devise an algorithm that preprocesses the graph in linear time …
DirectedCycle.java - Princeton University
Oct 29, 2025 · Below is the syntax highlighted version of DirectedCycle.java from §4.2 Directed Graphs.
edu.princeton.cs.algs4 (Algorithms 4/e)
edu.princeton.cs.algs4 (Algorithms 4/e)Package edu.princeton.cs.algs4