Search code examples
datastaxdatastax-enterprisegremlindatastax-enterprise-graph

Parameterize the number of iterations in the Gremlin pageRank step


As far as I understand gremlin pageRank step (g.V().pageRank()) runs a PageRank vertex program with 30 iterations.

Is it possible to change the max number of iterations?


Solution

  • This should work:

    g.V().pageRank().times(5)
    

    There's an example of this in the Apache TinkerPop docs:

    gremlin> g.V().pageRank().by('pageRank').times(5).order().by('pageRank').valueMap()
    ==>[pageRank:[0.15000000000000002],name:[marko],age:[29]]
    ==>[pageRank:[0.15000000000000002],name:[peter],age:[35]]
    ==>[pageRank:[0.19250000000000003],name:[vadas],age:[27]]
    ==>[pageRank:[0.19250000000000003],name:[josh],age:[32]]
    ==>[pageRank:[0.23181250000000003],name:[ripple],lang:[java]]
    ==>[pageRank:[0.4018125],name:[lop],lang:[java]]