Rewrite much of the graph code

This patch reimplements much of the logic used to produce the graph in
the main view. A set of git log inputs and expected outputs was created
in tools/test-graph-samples/, and a script to automatically evaluate
these examples was made in tools/unit-test-graph.sh. Please update these
samples if you find a new edge case or if you make changes to the
graphing code.

There are two aspects to the displayed graph which were not included in
this patch as the scope of the changes was deemed too large.

1. Commits that are both merge commits and branch points (or merge
commits and below a commit that is a branch point) can display a bit
ambiguously. The ideal fix for this is creating non-commit lines in the
main view when the graph is displayed. Example input and output can be
found in the samples folder.

2. Line colouring for lines crossing over other lines. Currently, each
pair of symbols (eg. '-|') shares a colour attribute. However, if the
two portions of the symbol are not connected, they should most likely
not share a colour. There are no unit tests implemented for this.