Skip to content

Finding and Deleting an edge #258

Answered by lvca
benanavd asked this question in Q&A
Jan 1, 2022 · 1 comments · 6 replies
Discussion options

You must be logged in to vote

@benanavd I'd say that is the least efficient way to find an edge in a graph database :-) In that case, you're right, you should start from the head or tail and look for the edge. The best would be having its RID so the complexity would be O(log1). In your case would be O(log1) to look up for the head or tail vertex + browse the edges. Then, the edges in the list are not sorted, so it depends on how many edges you have.

A solution would be to create an index on the edge on @out and @in, so you can use the index to look up the edge quickly.

Example:

CREATE INDEX Watched_out_in ON Watched (`@out`, `@in`) UNIQUE

You can omit UNIQUE if you can have multiple edges between the same vertices. C…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@lvca
Comment options

lvca Jan 1, 2022
Maintainer

@benanavd
Comment options

@lvca
Comment options

lvca Jan 3, 2022
Maintainer

@benanavd
Comment options

@lvca
Comment options

lvca Jan 3, 2022
Maintainer

Answer selected by lvca
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
2 participants