using node2vec in neo4j

Viewed 41

I am new to Neo4j and still trying to understand.I have a adjacency matrix of size 700*700 which i have imported into neo4j and now I want to use node2vec algorithm on that.Previously i have used the code

CALL gds.graph.project('all',
    [ 'Glucose','BloodPressure','SkinThickness','Insulin','BMI','DiabetesPedigreeFunction','Age'],
    {undirected:{type:'*', orientation:'UNDIRECTED'}})

CALL gds.beta.node2vec.stream("all", {walksPerNode: 2, embeddingDimension: 10}) 

Here since the columns were few i could add in the columns,but in my adjacency matrix i need to call all the columns i.e 700.Any suggestions in here would be of great help. Thanks in advance.

1 Answers

You can use * to denote all node labels in the graph database.

CALL gds.graph.project('all',
                        '*',
                       {undirected:{type:'*', orientation:'UNDIRECTED'}})

Also, below query will give you all labels in the database as a list then copy/paste into your code. Also, it is using an APOC function apoc.meta.stats so ensure that you have APOC installed.

CALL apoc.meta.stats() YIELD labels
RETURN [key IN keys(labels)|key] as all_labels

Sample result:
["TEST", "Parent", "TestNode", "Process", "Person", "NodeTest",  "NodeSample"]

I have seven nodes in the graph db so you see all seven of them as a list. Goodluck!

Related