Create multiple labels (hierarchical label) relationship

Dear Neo4j team,

I have simple graph of (:Agent{agentid, name, type})-[:Trans{tran_datetime, amount}]->(:Agent{agentid, name, type})
However due to large amount of transaction [Trans] (about several millions per day), I want to separate [Trans] into Year, Month.
Therefore I want to create model of

  • (:Agent{agentid, name, type})-[:Trans:2020:01{tran_datetime, amount}]->(:Agent{agentid, name, type})
  • (:Agent{agentid, name, type})-[:Trans:2020:02{tran_datetime, amount}]->(:Agent{agentid, name, type})
  • (:Agent{agentid, name, type})-[:Trans:2020:03{tran_datetime, amount}]->(:Agent{agentid, name, type})
  • ...
    How can I do that in Neo4j?

I read some userguide and it said that Relationship can not have multiple lables so I need to create many relationships e.g. (:Agent{agentid, name, type})-[:Trans_2020_02{tran_datetime, amount}]->(:Agent{agentid, name, type}) instead.
If doing by this way, I can not combine transaction from many months in to a single analytics.

Here is one way.

Hope this will work for you.

1 Like

Many thanks,

I understand the idea. Problem can be solved from partition Nodes on Day.
From Edge point of view, is there any way to divide Edges into smaller partition? I try to use index in relationship but it is also not workable. Neo4j v3.5 does not support Relationship indexing.

I am thinking about convert Tran to Node e.g.
but is will create many difficulty when applying PagRank, Community algorithms on this schema.

Please advice.

1 Like