Hi Khan,
Thanks for your question.
For this type of problem, there are two options.
- Create a vertex in between to store the edge attribute. For topology below, if A called B four times (TS1 TS2 TS3 and TS4 are 4 DateTime values).
A – (A-B-TS1)-- B
A – (A-B-TS2)-- B
A – (A-B-TS3)-- B
A – (A-B-TS4)-- B
We can create 6 vertexes and 8 edges. Having (A-B-TS1), (A-B-TS2), (A-B-TS3), (A-B-TS4) stay in between A and B.
To prevent duplicate ID, we can use from vertex ID (A) and to vertex ID (B) as part of the vertex ID in the middle. e.g. we can use the ID “A-B-2019-05-05 09:00” to create vertex (A-B-TS1). Where 2019-05-05 09:00 is the time the phone call happened.
This way it takes two hops to traverse from A to B, along the way you can collect all the info you need.
Pros: fast update, easy to remove an edge, easy to set a filter on the edge.
Cons: consume more memory, take an extra hop to traverse from A to B.
- Using global tuple and list type of attribute.
We can add an attribute on the edge under type of list of tuple.
Way of defining tuple:
https://docs.tigergraph.com/dev/gsql-ref/querying/data-types#tuple
Way of defininig list:
https://docs.tigergraph.com/dev/gsql-ref/ddl-and-loading/creating-a-loading-job#loading-a-list-or-set-attribute
This way you can directly access the list attribute to get the value. The way of using list attribute is identical as using ListAccum.
https://docs.tigergraph.com/dev/gsql-ref/querying/accumulators#listaccum
Alternatively, you can also define multiple lists to store different fields. The orders follow the order being loaded.
Cons: slow in updating and retrieving.
Pros: easy in defining the schema, memory saving.
Please let me know if you have further questions.