neo4j / graph-data-science

Source code for the Neo4j Graph Data Science library of graph algorithms.
https://neo4j.com/docs/graph-data-science/current/
Other
596 stars 157 forks source link

gds.alpha.nodeSimilarity.filtered.stream yields wrong id #230

Closed sjnov11 closed 1 year ago

sjnov11 commented 1 year ago

Describe the bug

CREATE (test: TEST {name:'test}) # id of node is 0
CREATE
  (alice:Person:Singer {name: 'Alice'}),
  (bob:Person:Singer {name: 'Bob'}),
  (carol:Person:Singer {name: 'Carol'}),
  (dave:Person {name: 'Dave'}),
  (eve:Person:Singer {name: 'Eve'}),
  (guitar:Instrument {name: 'Guitar'}),
  (synth:Instrument {name: 'Synthesizer'}),
  (bongos:Instrument {name: 'Bongos'}),
  (trumpet:Instrument {name: 'Trumpet'}),

  (alice)-[:LIKES]->(guitar),
  (alice)-[:LIKES]->(synth),
  (alice)-[:LIKES {strength: 0.5}]->(bongos),
  (bob)-[:LIKES]->(guitar),
  (bob)-[:LIKES]->(synth),
  (carol)-[:LIKES]->(bongos),
  (dave)-[:LIKES]->(guitar),
  (dave)-[:LIKES]->(synth),
  (dave)-[:LIKES]->(bongos);

GDS version: 2.2.1 Neo4j version: 4.4.11 Operating system: (for example Windows 95/Ubuntu 16.04)

Steps to reproduce the behavior: Follow this (https://neo4j.com/docs/graph-data-science/current/algorithms/alpha/filtered-node-similarity/) but create diff labeled node before.

Expected behavior Yield node Id should match

laeg commented 1 year ago

Hi @sjnov11

Just so we've got a full picture, is it a native or cypher projection?

Could you share your projection code as well please :)

sjnov11 commented 1 year ago

@laeg It is a native project.

CALL gds.graph.project(
    'myGraph',
    ['Person', 'Instrument','Singer'],
    {
        LIKES: {
            properties: {
                strength: {
                    property: 'strength',
                    defaultValue: 1.0
                }
            }
        }
    }
);
vnickolov commented 1 year ago

@sjnov11 thank you for raising this, very good find, we are having a look and will keep you updated when a fix for this is released.

vnickolov commented 1 year ago

Hello @sjnov11 the issue should be fixed in the latest GDS release - 2.2.4, I will close this issue, please feel free to re-open it if you have any trouble with the procedures.