So many factors play into both subjective and objective safety. This is an interesting project but I'm not sure how you algorithmically encode the route you should probably walk if you're going from the Hilton on O'Farrell to the Moscone.
The most direct route (stockton->market->howard) is actually the one I’d take in that case. What do you think it should suggest?
I guess that actually is a tad shorter--and the preferred route Google Maps gives you. A lot of people would be inclined to cut down to Market though because it seems more direct. (Google does give this as an alternate and the two are basically the same distance.)
O'Farrel to Market on Mason is definitely more shady than going down Stockton. Not so shady that I've personally felt unsafe, but it's the kind of place I have to step around a dice game on the sidewalk.