With pgRouting, you are not limited to roads but any network data can be used to find shortest path.
Various algorithms are available to solve shortest path problems, and we keep on developing new ones.