The prime geodesic theorem is reviewed for compact and finite volume Riemann surfaces and for finite and finite volume graphs. The methodology of how these results follow from the theory of the Selberg zeta function and the Selberg trace formula is outlined. Relationships to work on quantum graphs are surveyed. Extensions to compact Riemannian manifolds, in particular to three-dimensional hyperbolic spaces, are noted. Interconnections to the Selberg eigenvalue conjecture, the Ramanujan conjecture and Ramanujan graphs are developed.