Updated graph.cc with proper LMXRLF end condition