title: How can I neatly print a timeline with events?
body: <p>Our assignment is to display a timeline of events in Prolog.
  Our database looks something like this:</p>
  
  <pre><code>event(e1, 20).  
  event(e2, before(e1)).  
  event(e3, before(e2)).  
  event(e4, 15).  
  event(e5, before(5)).  
  event(e6, 30).  
  event(e7, before(e2)). 
  </code></pre>
  
  <p>Our idea is to define 2 points (0 and nil) as fixed values, and represent the timelines like this:</p>
  
  <pre><code>0   5   15  20  30          nil  
  \ x x e4    e1  e6  /  
  \ e5/             
  \ x e3  e2      /     
  \ x e7  /
  </code></pre>
  
  <p>(Sorry, I don't know how tabs work here, and I can't post a screenshot)</p>
  
  <p>Our idea is to find all possible paths from 0 to nil, and try to see which nodes can be merged.</p>
  
  <p>The paths would look something like this:</p>
  
  <pre><code>[  
  [0, e4, e1, e6, nil],  
  [0, e5, e4, e1, e6, nil],  
  [0, e3, e2, e1, e6, nil],  
  [0, e7, e2, e1, e6, nil]  
  ]
  </code></pre>
  
  <p>How can we find the events in the correct order? It seems we can't work our way forward from 0, because to find the first event, you have to make sure it's before some other event or something?</p>