arturo-lang / grafito

Portable, Serverless & Lightweight SQLite-based Graph Database in Arturo
MIT License
143 stars 7 forks source link

Bi-directional links #4

Closed drkameleon closed 2 years ago

drkameleon commented 3 years ago

@MichaelCMcCann https://github.com/arturo-lang/arturo/issues/23

Also, it would be nice if one could make certain links bi-directional. For example, rather than:

"Bob -> wife -> Sally”

A dual link such as: “Bob -> Husband/Wife <- Sally”

Many such links could be predetermined, so that “Bob -> Employee -> Google” would automatically create the connection “Google -> Employer -> Bob”

drkameleon commented 3 years ago

@MichaelCMcCann

This is an interesting point which I've though a lot about.

The initial, instinctive idea is to think of the relationships as uni-directional vectors. So, it can be either:

However, many well-know Graph databases, pretty much eliminate the need for such distinction.

So, in that sense (not that it's final - I'm still open to counter-arguments), I decided to make all links direction-agnostic. What is missing is a direction-agnostic search.

In a few words, the way the database is set up right now, A->B, automatically infers the opposite relationship. What is not possible so far is to search this relationship in both directions (but is something that can be easily implement and I will included it soon...)