Optimized graph solution