Gauge fields, knots, and gravity