Create optimized_graph.cpp

optimized version - first draft; not functional