gramph optimizations