Network routing algorithm implementation for iOS (Objective-C)