Fossil Forum

Algorithm for the timeline graph
Login

Algorithm for the timeline graph

Algorithm for the timeline graph

(1) By Alex Burdiyan (burdiyan) on 2023-11-21 19:04:21 [link] [source]

I've been diving a little bit into the internals of Fossil to learn about it, and I understand quite a bit now how everything works and fits together. Although there's still something pretty impressive about Fossil, that I can't understand well, which is the timeline graph page.

I really like how Fossil displays the timeline, and it's probably one of the best representations for working with a DAG of check-ins/commits I've seen in a while.

I've been trying to understand the particular algorithm Fossil uses, but the timeline.c source file is quite complicated, and I can't wrap my head around it yet. I was trying to see if there's any docs, or forums posts about it, but I couldn't find any.

I wonder if there's anything that is written about how Fossil draws the timeline graph? Maybe it's using some well-known algorithm, that I might lookup elsewhere?

To clarify, I'm only trying to understand how graph of check-ins work, with forks, and merges. I know there's more complexity about how other Fossil artifacts are displayed in the timeline, but I'm not currently looking into that.

(2) By Richard Hipp (drh) on 2023-11-21 19:12:28 in reply to 1 [source]

There is no writing about the graph generator, other than comments in the code.

The code in timeline.c just parses query parameters and figures out which graph to draw. The layout is computed by graph.c. The graph.c generates a table that is stored in the webpage as a JSON object. Javascript code in graph.js reads that table to renders the graph on-screen.

There is no theory behind the graph layout. I made up the algorithm as I went along. It has been improved incrementally over the years.

(3) By Alex Burdiyan (burdiyan) on 2023-11-21 21:05:39 in reply to 2 [link] [source]

Thanks Richard! I've found the graph.c and graph.js files right after I wrote this post, and realized that it was much more relevant than the code in timeline.c for what I was looking for. I will take a look at those files to learn more.