Ruby implementation of some famous graph algorithms