There are three ways to store a graph in memory:
- Nodes as objects and edges as pointers
- A matrix containing all edge weights between numbered node x and node y
- A list of edges between numbered nodes
I know how to write all three, but I'm not sure I've thought of all of the advantages and disadvantages of each.
What are the advantages and disadvantages of each of these ways of storing a graph in memory?