Boundary conditions on edges or nodes

Instead of constraining the dofs, you can set the nullspace operator, see for instance: Singular Poisson — DOLFIN documentation
and to define the nullspace operator: Bitbucket

You could also have a look at: Apply a DirichletBC to a single node - #2 by klunkean