Consider:
from dolfin import *
mesh = UnitCubeMesh(2,2,2)
cells = mesh.cells()
mesh.init(mesh.topology().dim()-2, 0)
edge_to_vertex = mesh.topology()(mesh.topology().dim()-2, 0)
for edge in range(mesh.num_edges()):
print(edge, edge_to_vertex(edge))