Updated how non-existent or empty files are handled by the graph_data function to be more resilient