Reputation: 989
The betweenness centrality of a node V is defined as the proportion of shortest paths between all pairs of nodes that go through V.
I have looked at the tinkerpop recipes documentation and i don't find it helpful/doesn't work. i.e it returns a
......1>
when i run the query.
the query ran is:
g.V().as("v").repeat(both().simplePath().as("v")).emit().
filter(project("x","y","z").by(select(first, "v")).
by(select(last, "v")).
by(select(all,"v").count(local)).as("triple").
coalesce(select("x","y").as("a").
select("triples").unfold().as("t").
select("x","y").where(eq("a")).
select("t").
store("triples")).
select("z").as("length").
select("triple").select("z").where(eq("length"))).
select(all, "v").unfold().
groupCount().next()
i am using the airroutes data provided by lawrence as in this guide http://kelvinlawrence.net/book/Gremlin-Graph-Guide.pdf. it does not contain centrality measures.. I have started with the below which would a) not give any cyclic paths and b) emit() modulator to “output” all the traversed vertices
g.V().repeat(both().simplePath()).emit()
how do i go from here to calculate the betweeness centrailty of the node/ or is there someplace else you would start.
Upvotes: 1
Views: 619
Reputation: 10904
You actually modified the query from the Gremlin Recipes site, there should be a comma between select("t")
and store("triples")
, not a period. However, this query will probably not work on the air-routes graph as it has way too many paths. As noted below the recipe, the query is only suitable for very small (sub)graphs. Even if you have enough memory for the computation, I think you'll have to wait a good amount of time (hours?) until you see a result.
IMO, you should consider a different centrality algorithm for a graph of this size. In the end, the results don't differ too much between algorithms and usually, the bigger your graph is, the less you care about accurate centrality values for each and every vertex. The classic PageRank algorithm, for example, runs perfectly fine on larger graphs.
Upvotes: 1