'split the graph into small regions' is a bit vague. I'm not sure what you are actually asking for help with here.
Also, you shouldn't be pre-deciding what elements of the language you want to use in an ad-hoc way because you are using a real-time application. There is no more reason why an if statement is unsuitable for real-time applications than any number of other things. Find solutions to problems, then if the code is too slow run a profiler to see what part of it is too slow and start trying to optimise it. Don't jump ahead pre-optimising things that may or may not be a problem.