Time Travel in the Back to the Future Universe with Neo4j [Community Post]


[As community content, this post reflects the views and opinions of the particular author and does not necessarily reflect the official stance of Neo4j.]

Introduction


This article explores time travel in the Back to the Future universe, and how we can use Neo4j to determine how a time traveller might experience the downstream effects of each time travel event.

Back to the Future


In case you are not familiar, Back to the Future is a popular time travel movie that uses the “forking” conception of timelines: with each time travel event to the past new timelines are created.

For example, if Marty travels from back in time from 1985 to 1955 and kills his father, then:

    1. a new timeline will be created in which Marty exists in 1955
    2. the previous timeline will not include Marty in 1955, and
    3. in this new Timeline, Marty will never be born, but will exist (briefly) in 1955.

The Grandfather Paradox


Back to the Future sidesteps the grandfather paradox (if time travel within a single timeline is possible, then a time traveler can kill his grandfather == paradox) through the “fork” method of time travel and the delayed action of “ripples,” which will be described at length below.

Here’s the gist of it:

When a time traveller travels, a new timeline is created. When a new timeline is created, time travellers, including inanimate objects, feel the effects of downstream and upstream changes based on their actions after a significant time delay.

Although time travellers seem to be “ripped” from their original timelines via time travel, they do retain some connection to their previous timelines.

The Behavior of the Unaltered Timeline


Back to the Future blog post Cristina Escalante (1)

Time moves from past to present to future

It’s worth noting that in the Back to the Future conception of the universe, time is unidirectional: the past moves to the future.

Places and people can only be in one state at a time

Within a timeline, places can only be in one state at a time.

For example, a place can not be simultaneously “Twin Pines Ranch,” a farm with a pair of pines at the entrance, and “Twin Pines Mall,” a paved-over shopping mall with a logo comprised of a pair of pines.

Similarly, Marty’s parents cannot simultaneously be teenagers and middle-aged adults at the same point in time. They must be one or the other.

Creating a Second Timeline


Learn How to Track Time Travel Events in the Back to the Future Universe Using Neo4j

Creating a second timeline is easy, with the right tools! 😉

In the Back to the Future universe, new timelines are created upon the execution of a time travel event.

In the films, this involved characters entering a time machine (the DeLorean or the Time Train), setting an end time and activating the time machine. After activation, the time machine appears in a fork of the initial timeline, branched at the end time programmed into the time machine.

Note that in the case of multiple timelines, a place can have different characteristics simultaneously.

For example, in Back to the Future, Marty travelled to the past and destroyed one of the twin pines at Twin Pines Ranch. Further along in Timeline 2, the location Twin Pine Mall was conceptualized and built as Lone Pine Mall.

In 1985, the “place” that was formerly known as Twin Pines Ranch was simultaneously Twin Pines Mall and Lone Pine ranch.

The Time Traveller


Assuming we live in a four dimensional world (x, y, z, time), time travellers in the Back to the Future universe are beings that have been in a sense lifted out of our four-dimensional existence into some fifth dimension in which they can traverse timelines and retain all memories of previous timelines.

To illustrate, imagine Marty is a drawing in a flip book labeled volume 1, page 1985. Doc, another drawing on the same page as Marty, wishes to travel to other pages in their flip book.

However, being two dimensional, they cannot experience anything but what is on their two-dimensional page.

Using advanced technology, Doc allows Marty to rip free of page 1985. Marty, now travelling in the third dimension, lands on Volume 2, page 1955 and is able to interact with the resident drawings.

But because Marty is ripped free, he is not attached to the flip book like the other drawings, and might be moved across volumes and pages against his will, as is illustrated in the “ripple effect” in the Back to the Future films, particularly in Part II.

The Ripple Effect


The “Ripple Effect” in the Back to the Future universe refers to the lag between the arrival of a time traveller travelling backwards in time to a new timeline and time travellers feeling the effects of the time travel event.

For example, when Marty travels backwards in time from Timeline 1 / 1985 to Timeline 2 / 1955 the first time, he observes family members disappearing from a photograph of his family he brought with him from Timeline 1 / 1985.

Note that travelling forward in time using a time machine does not create new timelines and does not create new ripples.

Back to the Future blog post Cristina Escalante (2)


The image above depicts the first two time travel events in the Back to the Future films. The first time travel was towards the future and did not result in a new timeline.

It is important to note that all time travellers seem to experience the ripple effect in the Back to the Future universe.

This is particularly noticeable in Back to the Future: Part II, in which Biff travels from Timeline 3 / 2015 to Timeline 4 / 1955. Doc, Marty, Jennifer and Einstein, who were in Timeline 3 / 2015, get rippled over to Timeline 4 as a result of Biff’s travel to Timeline 4 / 1955 and see the horrible effects of giving young Biff the sports almanac.

The gang didn’t have to use a time travel machine to travel to Timeline 4, but they were brought there unwillingly with intact memories.

Back to the Future blog post Cristina Escalante (3)


Exploring Time Travel with Neo4j


Back to the Future blog post Cristina Escalante (4)


Nodes

    • Traveller: A four-dimensional explorer in a five-dimensional world
    • TravelEvent: An event in which a Traveller travels forward or backwards in time
    • RippleEvent: Shockwaves created by TravelEvents that capture Travellers
    • Place: The place where a TravelEvent takes place
    • Time: Where TravelEvents and RippleEvents START and END

Relationships

    • NEXT: Within a timeline, Time nodes are connected by being NEXT to a previous Time node. Time nodes can only be NEXT to one node. Nodes with a NEXT relationship must be in the same Timeline.
    • IN_EVENT: A Traveller has an IN_EVENT relationship with any TravelEvents he/she is a participant of.
    • TRIGGERS: A TimeEvent TRIGGERS a RippleEvent
    • CAPTURES: A RippleEvent CAPTURES Travellers
    • START: TimeEvents and RippleEvents are associated with two timelines. START marks the first timeline.
    • END: TimeEvents and RippleEvents are associated with two timelines. END marks the first timeline.
    • AT_PLACE: TimeEvents occur at particular places

The Data

Using LOAD CSV to load data from Google Sheets

Google Sheets has a great capability to store and manage data in a CSV format. Sheet’s export capability generates a unique URI you can access with Neo4j’s LOAD CSV.

Gathering the Data

Luckily, Back to the Future has a devoted fan base dedicated to collating every detail of the series. I gathered the majority of the Back to the Future timeline data from Futurepedia and cross-referenced place data with this YouTube video.

Using LOAD CSV, I loaded the time nodes, traveller nodes, time travel event nodes and the relationships between the nodes.

back-to-the-future-time-travel-data


back-to-the-future-data-model


// Creating the Time Nodes

LOAD CSV 
WITH HEADERS FROM "https://docs.google.com/a/tsl.io/spreadsheets/d/"+
"1JJMGFVuTtdrkAh9xbUc0zV63LNDQoMJoopr1YKuzkbA/export"+
"?format=csv&id=1JJMGFVuTtdrkAh9xbUc0zV63LNDQoMJoopr1YKuzkbA"+
"&gid=97677800" AS timerels
MATCH (s:Time),(e:Time)
WHERE s.time_id = toFloat(timerels.time_id) 
     AND  e.time_id = toFloat(timerels.next)
MERGE (s)-[:NEXT]->(e)

// Create Time Relationships

LOAD CSV 
WITH HEADERS FROM "https://docs.google.com/a/tsl.io/spreadsheets/d/"+
"1JJMGFVuTtdrkAh9xbUc0zV63LNDQoMJoopr1YKuzkbA/export"+
"?format=csv&id=1JJMGFVuTtdrkAh9xbUc0zV63LNDQoMJoopr1YKuzkbA"+
"&gid=97677800" AS timerels
MATCH (s:Time),(e:Time)
WHERE s.time_id = toFloat(timerels.time_id) 
      AND  e.time_id = toFloat(timerels.next)
MERGE (s)-[:NEXT]->(e)

// Travellers

CREATE (marty:Traveller {name:"Marty McFly", key:"MM"}),
(doc:Traveller {name:"Emmett Doc Brown", key:"EB"}),
(einstein:Traveller {name:"Einstein", key:"E"}),
(jennifer:Traveller {name:"Jennifer Parker", key:"JP"}),
(biff:Traveller {name:"Biff Tannen", key:"BT"})

// TravelEvent

LOAD CSV 
WITH HEADERS FROM 
"https://docs.google.com/a/tsl.io/spreadsheets/d/"+
"1JJMGFVuTtdrkAh9xbUc0zV63LNDQoMJoopr1YKuzkbA/export"+
"?format=csv&id=1JJMGFVuTtdrkAh9xbUc0zV63LNDQoMJoopr1YKuzkbA"+
"&gid=1131483036" AS travelevent
MATCH (start:Time {time_id:toFloat(travelevent.start)}), 
      (end:Time {time_id:toFloat(travelevent.end)})
MERGE (start)<-[:START]-(n:TravelEvent 
      {travelKey:toFloat(travelevent.travel_id)})
      -[:END]->(end)
RETURN travelevent

// Travellers in the TravelEvents

LOAD CSV 
WITH HEADERS FROM 
"https://docs.google.com/a/tsl.io/spreadsheets/d/"
+"1JJMGFVuTtdrkAh9xbUc0zV63LNDQoMJoopr1YKuzkbA/export"+
"?format=csv&id=1JJMGFVuTtdrkAh9xbUc0zV63LNDQoMJoopr1YKuzkbA"+
"&gid=402569014" AS travelevent
MATCH (event:TravelEvent 
      {travelKey:toInt(travelevent.travel_key)}),
      (t:Traveller {key:travelevent.traveller_key})
MERGE (t)-[:IN_EVENT]->(event)
RETURN travelevent, t


Who went when, how?

Time Travel Events
back-to-the-future-time-travel-events


What sort of time travel event cause the creation of new Ripples?

As we learned from the Back to the Future series, time travellers (no matter where or when they are, it seems) feel the ripple effect upon the creation of a new timeline. New timelines are created when a time traveller travels back in time.

In the table above, note that in row 6, Marty, Doc Brown and Jennifer travel from Timeline 3 to a future time in Timeline 3.

In row 8, notice that Marty, Doc Brown and Jennifer have travelled from Timeline 4 to Timeline 5 without ever travelling from Timeline 3 to Timeline 4! How did this happen? They must have been shifted via the ripple effect.

Take a look at row 7, in which Biff travels from Timeline 3 to Timeline 4 to give his younger self a copy of a sports almanac, causing a ripple extending backwards and forwards in time, pushing Marty, Doc Brown and Jennifer into Timeline 4 without their consent.

Using Cypher to Find Ripple Events

To recap, we’re looking for events in which time travellers moved timelines without necessarily engaging in a time travel event. We know that:

    • new timelines are created when someone travels to the past
    • ripple events are not instantaneous: it takes some time for time travellers to feel the effects of the time travel event

To start, let’s use Cypher to find cases in which a time traveller went to the past. Luckily, aside from Einstein travelling a minute into the future, all the time travel events in the Back to the Future series involved travelling to a different year.

back-to-the-future-ripple-effect


Next, let’s find out who is eligible to be swept up in a Ripple.

Until a regular person participates in a time travel event, they don’t retain their memories as their timeline changes around them.

Let’s look for the time traveller status of each potential time traveller at each time travel event.

back-to-the-future-ripple-effect-neo4j

Voilà – a list of time travel events and the travellers caught in each ripple.

The first time traveller caught in a ripple was Einstein, but since he is a dog, he didn’t really notice the effects of Marty going back in time to 1955 (the entire plot of Back to the Future, Part I).

The second ripple was created when Doc travelled back in time to pick up Marty and Jenny. There were so many subsequent jumps back and forth in time during Back to the Future, Part II that, in this case, you should just watch the movie.

The third ripple played a large role in Back to the Future, Part II: Biff takes a sports almanac to 1955, giving his younger self an advantage. In 2015, time travellers Marty, Doc, Einstein and Jennifer feel the shockwaves as they are moved from Timeline 3 to Timeline 4 and scramble to save themselves, their city and their pasts.

References





Want to learn how you can do a similar project using a graph database? Click below to get your free copy of O’Reilly’s Graph Databases ebook and discover how to use graph technology for your most complex challenges.