Stored Procedure to find the k-neighborhood of a node
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/main/java/com/maxdemarzi
.gitignore
LICENSE
README.md
pom.xml

README.md

K-Nearest Neighbors Count

Stored Procedure to find the k-neighborhood count of a node

Instructions

This project uses maven, to build a jar-file with the procedure in this project, simply package the project with maven:

mvn clean package

This will produce a jar-file, target/knn-1.0-SNAPSHOT.jar, that can be copied to the plugin directory of your Neo4j instance.

cp target/knn-1.0-SNAPSHOT.jar neo4j-enterprise-3.4.7/plugins/.

Edit your Neo4j/conf/neo4j.conf file by adding this line:

dbms.security.procedures.unrestricted=com.maxdemarzi.*    

Restart your Neo4j Server. A new Stored Procedure is available:

MATCH (n) WHERE id(n) = x WITH n 
CALL com.maxdemarzi.knn(n) YIELD number
RETURN number

MATCH (n) WHERE id(n) = x WITH n 
CALL com.maxdemarzi.knnx(n, 7) YIELD number
RETURN number

MATCH (n) WHERE id(n) = x WITH n 
CALL com.maxdemarzi.knnx2(n, 7) YIELD number
RETURN number