Thank you for your replies - I am indeed looking for something like floyd_warshall_shortest_paths.
How can I access the first element of floyd_warshall_shortest_paths (the distances)? I will need to save this.
@hdavid16 My food webs are large so it would not be practical to add edges manually.