  We develop an algorithm to apply the Dalgarno-Lewis (DL) perturbation theory
to quantum graphs with multiple, connected edges. We use it to calculate the
nonlinear optical hyperpolarizability tensors for graphs and show that it
replicates the sum over states computations, but executes ten to fifty times
faster. DL requires only knowledge of the ground state of the graph,
eliminating the requirement to determine all possible degeneracies of a complex
network. The algorithm is general and may be applied to any quantum graph.
