When in doubt, always err on the side of caution. If you're not sure if someone wants a hug, just ask.
Also, be sure to keep your hugs at least 5 inches from the face. Anything less is just a awkward shoulder touch.
Hug Distance: The Science of not squishing faces.