Pregel node degree is 0 even if it has relationships

I'm projecting a graph with the below code:

CALL gds.graph.project(
'entityGraph',
'Entity',
'TO_ENTITY'
)

When I use this projected graph in the call to GDS algorithm dijkstra it returns the desired result. However, when I use this graph in my custom pregel function, when I debug info of the given start node's degree, it says 0. I'm absolutely sure that my start node has TO_ENTITY relationships as I see them when I query that node.

My GDS version is 2.0.4

What might be the cause of the pregel displaying degree as zero?

Thanks.

Note, that the node ids that you see in Pregel (or in GDS in general) are not necessarily the same node ids as in the database. When we project the graph (via native or Cypher projection), we map the original node id space to an internal, consecutive node id space: [0, nodeCount).

For example, let's say you project the Neo4j nodes [42, 1337, 1984, 2001] into the in-memory graph. In GDS, those could be mapped to {0 => 42, 1 => 1337, 2 => 1984, 3 => 2001}.

I assume that you want to figure out if the context.nodeId() is the same as some source node id that you passed in via the config?

Thanks for the explanation. My problem is actually with the degree(the number of relationships a node have). I'm sure that given node has relationships and I can see in the output of graph.create method that relationships have been created. Also, when I run core gds functions such as shortestpaths.dijkstra with the same graph, it returns the desired results. The problem is with the pregel. It somehow can't see the relationships of nodes.

Do you have the code available on GitHub so that I can take a look?

All procedures that take node ids as part of their configuration, including gds.shortestPath.dijkstra translate the given node id to the internal node id. Pregel does not do this out of the box, that's why I thought that you end up looking at the wrong node (i.e. node 0 in Pregel is not node 0 in Neo4j). But best to share some code to verify. Pregel is also used for gds.pageRank and works fine, so I assume it's an input problem.

You can see my code here : Cüneyt Tyler / Dijkstra Multiple Inputs · GitLab

Actually, I'm printing the degree for the start node and that's 0.