user2252650
user2252650

Reputation: 1

weighted graphs in jave with embedded neo4j

I have a question about weighted graphs in neo4j. Is a property (like ".setProperty("cost", weight)") the only way of constructing a weighted graph. The problem is that a program, which often needs this weights by "(Double) rel.getProperty("cost")" will get too slow, because the cast takes some time;

Upvotes: 0

Views: 106

Answers (1)

Peter Neubauer
Peter Neubauer

Reputation: 6331

Well, you actually could encode the weight into the relationship type which is faster, something like

create a-[:`KNOWS_0.34`]->b

http://console.neo4j.org/r/2dez98 for an example.

Upvotes: 1

Related Questions