Showing results for 
Search instead for 
Did you mean: 

How can I create a graph out of imported nodes ordered according to their timestamp?

After doing all of the beginner courses and a few graph data science courses I still cannot answer this question:
I would like to create process models based on event data.
Each node is an event (containing multiple properties - ONE important one is the timestamp) that must be ordered in a sequence according to the timestamp property within a timeframe of e.g. one day.

I would like to have all the events of one day ordered according to their timestamp and create the relationship "Directly_Follows" in between each node.

Ideally, I would also like to have a conditional if the node contains a property - event_type: 'start'/'end' to stop the DF graph. But for now let us just try to order the nodes according to their timestamp. It can be seen in the image below how I want the nodes to look after my import.


Thank you for your help!



Are these events being generated in realtime and you want to add to the graph as they are generated? If so, can you process them in time order, or can the be received from multiple source and can be out of order? If the order of ingestion is time ordered, then you can append the new events to the end of the chain. You would just need to get the end node. You could either figure that each each time you append, or you could maintain a relationship to the end node, so the lookup would be quick.

If the events are not received in order, you will need to perform and 'insert' operation, where you find the two connected nodes who's time falls before and after the time of the event.

Either scenario can handle the 'start' and 'end' event type when you are consuming the new event.

How do you plan to implement this? Are you writing an application with one of the drivers? This also seems like a good application of custom procedures using the Neo4j Java API. You could write procedures that perform the 'inserts/append' operations, and any other operations you need. Then you call them from your driver through cypher.

Feel free to post more if you have any specific questions or implementation ideas you want to vet.

Node Link

Create .svg circles whose x y properties are x y of Neo4j

Nodes 2022
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.