A tropical curve in R3 contributes to Gromov–Witten invariants in all genus. Nevertheless, we present a simple formula for how a given tropical curve contributes to Gromov–Witten invariants when we encode these invariants in a generating function with exponents of λ recording Euler characteristic. Our main modification from the known tropical correspondence formula for rational curves is as follows: a trivalent vertex, which before contributed a factor of n to the count of zero-genus holomorphic curves, contributes a factor of 2 sin (nλ/ 2). We explain how to calculate relative Gromov–Witten invariants using this tropical correspondence formula, and how to obtain the absolute Gromov–Witten and Donaldson–Thomas invariants of some 3-dimensional toric manifolds including CP3. The tropical correspondence formula counting Donaldson–Thomas invariants replaces n by i- ( 1 + n )qn / 2+ i1 + nq- n / 2.