Is there an easy way to query a cluster for all vertices that have no incoming edges?
Asked
Active
Viewed 2,254 times
4 Answers
14
This is more complete because also covers the case the collection exists but it's empty:
select from the_cluster where in().size() = 0

Lvca
- 8,938
- 2
- 24
- 25
-
should be a single `=`, though. – Thilo Jan 13 '12 at 11:44
-
I just ran this query, and am getting all the vertices as the output, including those that have incoming edges. Am I missing something? – user3295878 Feb 05 '16 at 11:01
-
@Lvca: This one worked. Did it get changed in the newer version? – user3295878 Feb 06 '16 at 10:50
0
Should it be this?
select from the_cluster where in_edgename is null
I know it's an old question but figured for anyone else who was wondering the same thing.

Masa
- 1
-
2Please make your answer more assertive. While this looks to answer the question (and really looks like the accepted answer, actually) the **Should it be this?** make your answer more like a question to the OP and then irrelevant for an answer but belonging to a comment. If you do know the answer, state the answer, do not question it. – β.εηοιτ.βε Apr 19 '15 at 19:48
0
You can do something like this: for a vertex of a class say Vtex and the Edge of class say Edg
select from Vtex where in('Edg').size() =0
This will return all the vertices of Vtex class which have no incoming edge of type Edg.
0
The following SQL seems to work (as edges are stored as fields in
and out
on the vertices):
select from the_cluster where in is null

Thilo
- 257,207
- 101
- 511
- 656