We give a conceptual formulation of Kontsevichs `dual construction producing graph cohomology classes from a differential graded Frobenius algebra with an odd scalar product. Our construction -- whilst equivalent to the original one -- is combinatorics-free and is based on the Batalin-Vilkovisky formalism, from which its gauge-independence is immediate.