Search code examples
importtigergraph

#TigerGraph Import : one csv for each relation type?


I’ve just started using TigerGraph, and I saw in the import example that the edges files: friendship.csv is separated from the vertices files: person.csv.

Does it mean that if I have, say, 10 edges types I need or it would be better, to have 10 distinct csv files, each for a specific edge type ?


Solution

  • It's generally easier, but NOT necessary to have separate files for your edges.

    For relationships where edges are one to one, you can get away with using the same file for data and relationships.

    Example with 'Person' being a vertex with attribute 'name'. 'friend' is an edge connecting two 'Persons':

    Person ID Name Friend
    person_1 Bill person_7
    person_2 Sue person_9
    person_3 Ann person_8

    If your relationships are one to many, it may make sense to have a separate file for each relationship to prevent data duplication. For example, you could either use a single file with duplication like this:

    Person ID Name Friend
    person_1 Bill person_7
    person_1 Bill person_6
    person_2 Sue person_9
    person_2 Sue person_5

    Or a separate data and edge file like here:

    Data:

    Person ID Name
    person_1 Bill
    person_2 Sue
    person_3 Ann

    Edges:

    Person ID Friend
    person_1 person_7
    person_1 person_6
    person_2 person_9
    person_2 person_5