About 35 years ago, I bike commuted on a Raleigh three speed to work in a relatively tough neighborhood in Minneapolis. Apparently there was a teenager who must have liked my bike because one time he was waiting at the side of the road kneeling with a long stick. As I passed, he tried to put it into my spokes. The flaw in his plan is, of course, it's really easy to see and swerve around, and he ended up just looking stupid.
A person on foot has to be very clever to mug someone on a bike successfully. Unless they have you cornered, they're not really going to get close enough to be much of a threat.