Loops, knots, gauge theories and quantum gravity