Help with GraphComputer.vertices() Filter

87 views
Skip to first unread message

John J. Szucs

unread,
Jan 5, 2018, 12:21:44 PM1/5/18
to JanusGraph users
In a unit test, I have a graph that contains 7 vertices with label A and 48 vertices with label B. I need to run a GraphComputer VertexProgram over vertices with label A only, so I do this:

Traversal<Vertex, Vertex> vertices=graph.traversal().V().hasLabel("labelA");
GraphComputer computer=graph.compute().vertices(vertices);
VertexProgram<Double> program=new MyVertexProgram();
ComputerResult result=computer.program(program).submit().get();


The unit test fails as follows:

org.janusgraph.core.JanusGraphException: Failed to process [48] vertices in vertex program iteration [1]. Computer is aborting.

Note that 48 in the exception message is exactly the number of vertices (with label B) that I intentionally filtered out.

I strongly suspect I am misunderstanding the API, as I am fairly new to Gremlin (but not Blueprints).

Can anyone offer advice on how to do this correctly? Thanks in advance!

-- John

Daniel Kuppitz

unread,
Jan 5, 2018, 12:56:39 PM1/5/18
to JanusGraph users
vertices() takes an anonymous traversal. This should work for you:

graph.compute().vertices(__.hasLabel("labelA"));

Cheers,
Daniel


--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/13bfd79a-6944-4204-b038-06d56d80740e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

John J. Szucs

unread,
Jan 5, 2018, 1:59:44 PM1/5/18
to JanusGraph users
Daniel,

Thanks for the response. Unfortunately, I get the same result: a JanusGraphException indicating that the GraphComputer failed to process 48 vertices.

-- John


On Friday, January 5, 2018 at 12:56:39 PM UTC-5, Daniel Kuppitz wrote:
vertices() takes an anonymous traversal. This should work for you:

graph.compute().vertices(__.hasLabel("labelA"));

Cheers,
Daniel

On Fri, Jan 5, 2018 at 9:21 AM, John J. Szucs <john.j...@gmail.com> wrote:
In a unit test, I have a graph that contains 7 vertices with label A and 48 vertices with label B. I need to run a GraphComputer VertexProgram over vertices with label A only, so I do this:

Traversal<Vertex, Vertex> vertices=graph.traversal().V().hasLabel("labelA");
GraphComputer computer=graph.compute().vertices(vertices);
VertexProgram<Double> program=new MyVertexProgram();
ComputerResult result=computer.program(program).submit().get();


The unit test fails as follows:

org.janusgraph.core.JanusGraphException: Failed to process [48] vertices in vertex program iteration [1]. Computer is aborting.

Note that 48 in the exception message is exactly the number of vertices (with label B) that I intentionally filtered out.

I strongly suspect I am misunderstanding the API, as I am fairly new to Gremlin (but not Blueprints).

Can anyone offer advice on how to do this correctly? Thanks in advance!

-- John

--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-use...@googlegroups.com.

Daniel Kuppitz

unread,
Jan 5, 2018, 3:35:09 PM1/5/18
to JanusGraph users
Hmm, I don't think that has anything to do with the filter. Have you tried a different vertex program, e.g. PageRankVertexProgram?

Cheers,
Daniel


To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/6c3686f2-b616-4161-9f7e-7d615a387685%40googlegroups.com.

mikio.t...@gmail.com

unread,
Oct 22, 2018, 11:31:55 AM10/22/18
to JanusGraph users
Hi,

I am wondering how this problem has been resolved.
I have the same issue with JanusGraph 0.3.1.  The same filters work with TinkerGraph.

The filters are something like as follows.  I applied one filter at once.
VERTEX and VERTEX_IDX are Strings. VERTEX is defined as vertex label for JanusGraph.
computer.vertices(__.hasLabel(VERTEX));
computer
.vertices(__.has(VERTEX_IDX));
computer
.vertices(__.has(VERTEX_IDX, P.eq(0L)));
computer
.vertices(__.has(VERTEX_IDX, P.test((a,b)->((Long) a) % 2 == 0L, 0L)));

I appreciate any suggestions.
-- Mikio Takeuchi


2018年1月6日土曜日 5時35分09秒 UTC+9 Daniel Kuppitz:
Reply all
Reply to author
Forward
0 new messages