I still don't fully understand what the nodes and edges in this graph "is" though. It's not patches. And I can't believe it is "all of the code" in each commit because that sounds very expensive.
On a lower level, a commit is itself a bunch of pointers to files. Different commits can share files. Think about copy-on-write.