Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

"Firehouse" Problem

Name: Anonymous 2009-01-30 15:51

If you have an undirected, unweighted graph G, and a marked subset of points called 'Firehouses,' is there an O(n+m) algorithm to find every vertex's closes firehouse?

I can only come up with O(n^2) stuff. Although I do like the idea of repeatedly raising the adjacency matrix to a power n, until every vertex has a nonzero entry :P

Name: Anonymous 2009-01-31 14:04

Did >>5 elude you somehow? Do any search you'd like first to find all the fucking firehouses. Do a BFS with a start point at each firehouse, keep track of origin (optional), and assign nodes to houses as you encounter them. Oh, and of course, don't keep your graph in a god damn adjacency matrix. HTH, Now stop trolling.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List