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
637 stars 161 forks source link

Error: Neo.ClientError.Procedure.ProcedureNotFound #140

Closed okpalan2 closed 2 years ago

okpalan2 commented 2 years ago

I am running neo4j from the windows teminal, and trying to execute a cypher script from the terminal at page 54 in chapter 4.I receive this error:

There is no procedure with the name `gds.alpha.shortestPath.stream` registered for this database instance. Please ensure you've spelled the procedure name correctly and that the procedure is properly deployed.

Neo4jBug What plugins are needed to resolve this error message?.

mnd999 commented 2 years ago

Do you have the GDS library installed? Instructions for doing so are here. You don't mention where to find the example you refer to, but the algorithm you refer to is alpha so may have changed in the version of GDS you have installed.

Generally we prefer to answer these types of questions in our community forums or on our discord and you will likely get a faster response there. Github is more setup for bug reports in the product.

okpalan2 commented 2 years ago

I have neo4j desktop, I find using long documentation difficult to find things. I would check if a way to install GDS library using the desktop application.

okpalan2 commented 2 years ago

Apparently not, would you consider including the GDS plugins with neo4j distributions?Feel free to close the issue,as I found a third party website with instruction on how to set up GDS with neo4j.

okpalan2 commented 2 years ago

For the record: Neo4j has implemented very useful algorithms in order to derive insights from your graph data.

The Louvain algorithm for community detection or PageRank for centrality for finding important nodes in your graph are just some examples of them.

A couple of days ago, the GDS 1.2 preview was out and is now compatible with Neo4j 4.x, here are the installation instructions :

Download the GDS 1.2 library from the Neo4j Download Centre

Unzip the downloaded the file and copy the .jar file into the plugins directory of your Neo4j server.

Amend the neo4j.conf file in order to allow the gds. procedures (assuming you have the APOC plugin as well, otherwise remove ,apoc.) :

dbms.security.procedures.unrestricted=gds.,apoc. dbms.security.procedures.whitelist=gds.,apoc.

or if you use Docker, add the following lines to the environment :

NEO4J_dbms_security_procedures_unrestricted=gds.,apoc. NEO4J_dbms_security_procedures_whitelist=gds.,apoc.

Restart Neo4j

okpalan2 commented 2 years ago

If anyone is want to know of the website used, it's domain "graphaware.com"

okpalan2 commented 2 years ago

Add the following to the neo4j config in the absolute path of the neo4j configuration folder /conf: dbms.security.procedures.unrestricted=gds.,apoc. dbms.security.procedures.whitelist=gds.,apoc. then restart.

Mats-SX commented 2 years ago

@okpalan I'm not sure exactly what your problem is, but I will try to give you some general advice.

The latest and greatest version of GDS is 1.8.0, which was released just two days ago. You can download it from the Neo4j Download Center. You will also find the next-latest version of 1.7.3 which has been GA for several months. I strongly advise against using any other version, with the rare exception that you are using Neo4j 3.5, in which case your only choice is to use GDS 1.1.7 (also on the Download Center). You will find installation instructions in the GDS Manual. I promise that it isn't too long of a read!

However, for maximum convenience, I would recommend using Neo4j Desktop and just using the Neo4j Graph Data Science plugin that is included with it. Then you needn't worry about getting the right version; the plugin knows which version works where. I recommend that you make sure to use the latest patch of Neo4j (at the time of writing it would be the very fresh 4.4.0, but 4.3.7 is also a good choice). Installation instructions are here, but it's really just a click of the right button. I noticed the picture in our documentation is from an older version of Neo4j Desktop. This is what it looks like on the newest Neo4j Desktop version:

Screenshot 2021-12-03 at 08 56 05

When using the Neo4j Desktop plugin to install GDS, you needn't worry about extra configuration; the plugin will take care of it. Of course, if you intend to work on large data volumes, you may need to increase the heap memory configuration; instructions for that are somewhat more advanced. But this is not necessary to just get started and learn!

Oh, and finally I would recommend using our Browser Guide to get familiar with the Neo4j GDS library. It is intended to save you from reading all of manual up front, but will use a concrete use case and help you run actual queries and algorithms to get familiar with the GDS API. To use it, just run :play graph-data-science in your Neo4j Browser, following a successful installation as per above.

I hope this helps! Regards Mats

okpalan2 commented 2 years ago

Thank you this was really helpful.

okpalan2 commented 2 years ago

The gds library is installed.However ,is their an update api for "gds.alpha.shortestPath.stream".It seem that thier might be an api change.

MATCH (source:Place {id: "Amsterdam"}),
 (destination:Place {id: "London"})
CALL gds.alpha.shortestPath.stream({
 startNode: source,
 endNode: destination,
 nodeProjection: "*",
 relationshipProjection: {
 all: {
 type: "*",
 orientation: "UNDIRECTED"
 }
 }
})
YIELD nodeId, cost
RETURN gds.util.asNode(nodeId).id AS place, cost

The algorithm refuses to run.

Mats-SX commented 2 years ago

@okpalan Yes, the procedure gds.alpha.shortestPath was removed in 1.5 when we promoted several path finding algorithms to the beta tier. The query you posted will not work in new versions of GDS. Since GDS 1.6 there are four different path finding algorithms in our highest tier (beta procedures from 1.5 were promoted). Once a procedure has made it to the highest tier, we guarantee semantic versioning for it, meaning we will only make backwards compatible changes to it. You can read a little about our tiers here.

The procedure which was previously called gds.alpha.shortestPath.stream is now called gds.shortestPath.dijkstra.stream and you can find documentation for how to use it on the Dijkstra Source-Target or Dijkstra Single-Source documentation pages, depending on which version of the algorithm you want to compute. From your example query, it seems like the Source-Target version would be appropriate. Please also be aware that other things have changed in the procedure API, and just updating the name may not be enough.

For example, this query is taken from the stream example on the Source-Target page:

MATCH (source:Location {name: 'A'}), (target:Location {name: 'F'})
CALL gds.shortestPath.dijkstra.stream('myGraph', {
    sourceNode: source,
    targetNode: target,
    relationshipWeightProperty: 'cost'
})
YIELD index, sourceNode, targetNode, totalCost, nodeIds, costs, path
RETURN
    index,
    gds.util.asNode(sourceNode).name AS sourceNodeName,
    gds.util.asNode(targetNode).name AS targetNodeName,
    totalCost,
    [nodeId IN nodeIds | gds.util.asNode(nodeId).name] AS nodeNames,
    costs,
    nodes(path) as path
ORDER BY index
okpalan2 commented 2 years ago

Thank you for your support.