Skip to content

Graph Procedures

Abhivanth Murali edited this page Aug 28, 2023 · 10 revisions

Initial Neo4j setup

Our Aim is To enable user-defined graph procedures for spectral clustering of graph data models in Neo4j. We extend this from the already available Decision Tree Plugin (DTP). The initial steps to set up the DTP plugin in Neo4j Desktop are explained below.

Generation of the jar file.

Clone the DTP repository to the local system.(DTP-Plugin)

With Maven installed, a jar file can be generated with the command mvn clean install in the terminal of the IDE used(Intellij, Eclipse).

Changes to be made before generating, the jar file:

  • change the password inside the methods which enable the plugin to connect to Neo4j. This password should be a minimum of 8 characters long.

jar_generation

Password change in all required methods

password_change

Neo4j Desktop Install and Setup

Download the neo4j Desktop from its website (Neo4j Desktop) and install it.

step to follow after installing to set a local DBMS:

  • Open the Neo4j Desktop application and click 'Add', under the pop-down menu click 'Local DBMS'.
  • A create menu will be opened, with the options of the database name, password, and version.
  • Version number should be '4.3.2', set a password of your choice(same as the one used inside of the methods of the plugin) and click "Create".
  • Click on the "3" dots in the newly created local Dbms and click "Open folder".
  • Open the "Plugins" folder and add the generated Jar file(DTP).
  • Open the "Import" folder and add all Data-related files(Testing set, Training set, etc...).

localDbms

dbmsFolders

Run DTP: An Example

Run the DTP plugin with the "Heart failure prediction" Dataset. An important point to be noted is that the dataset files in the import folder should not contain any spaces in their names. After starting the local DBMS, open a neo4j browser and run the following steps.

step one:

LOAD CSV WITH HEADERS FROM "file:///TrainingSet.csv" AS line WITH line CREATE (p:P_train { anaemia: toInteger(line.anaemia),creatinine_phosphokinase: toInteger(line.creatinine_phosphokinase), diabetes: toInteger(line.diabetes), ejection_fraction: toInteger(line.ejection_fraction), high_blood_pressure: toInteger(line.high_blood_pressure), platelets: toFloat(line.platelets), serum_creatinine: toFloat(line.serum_creatinine), serum_sodium: toInteger(line.serum_sodium), smoking: toInteger(line.smoking), time: toInteger(line.time), DEATH_EVENT: toInteger(line.DEATH_EVENT), age:toInteger(line.age), sex: toInteger(line.sex)}) RETURN count(*);

RETURN main.queryTrainData("P_train");

step two:

LOAD CSV WITH HEADERS FROM "file:///TestingSet.csv" AS line WITH line CREATE (p:P_test { anaemia: toInteger(line.anaemia),creatinine_phosphokinase: toInteger(line.creatinine_phosphokinase), diabetes: toInteger(line.diabetes), ejection_fraction: toInteger(line.ejection_fraction), high_blood_pressure: toInteger(line.high_blood_pressure), platelets: toFloat(line.platelets), serum_creatinine: toFloat(line.serum_creatinine), serum_sodium: toInteger(line.serum_sodium), smoking: toInteger(line.smoking), time: toInteger(line.time), DEATH_EVENT: toInteger(line.DEATH_EVENT), age:toInteger(line.age), sex: toInteger(line.sex)}) RETURN count(*);

RETURN main.queryTestData("P_test");

step 3:

RETURN main.createTreeGR("DEATH_EVENT","True","3");

Clone this wiki locally