memgraph / mage

MAGE - Memgraph Advanced Graph Extensions :crystal_ball:
Apache License 2.0
247 stars 24 forks source link

[Question] How to add personalisation vector to nxalg.pagerank #202

Closed risufaj closed 1 year ago

risufaj commented 1 year ago

Hello,

I'm attempting to write a query that also calculates personalized pagerank. However, I can't figure out how to add the personalisation vector to the call. The issue is that in nxalg, it is not clear how the personalisation vector is supposed to be represented. Here: https://github.com/memgraph/mage/blob/main/python/nxalg.py#L489 personalisation is supposed to be a string, which is then converted to a dictionary (as far as I understand). Are there any examples of how the string should look? Is it a string representation of a dictionary? if so, what should the keys be: nodes, or node ids?

Thank you in advance

antepusic commented 1 year ago

Having examined the code, the personalization vector is taken from the graph stored in Memgraph as follows:

The rationale behind this is that, if you have a large graph, calling nxalg.pagerank this way is much more convenient than passing an enormous dictionary with one item per each node.

risufaj commented 1 year ago

Thanks for the answer! I'll close this.