Showing results for 
Search instead for 
Did you mean: 

Head's Up! Site migration is underway. Pause, resolving how to handle anonymous content

Relationship weighting

Node Link


I am a 17-year-old student (Year 12 / 11th grade) writing an essay on link prediction algorithms and am new to neo4j so bear with me as I attempt to abysmally unfold my thought process in this question.

I am attempting to create a data set of a group of people with different relationships such as friends and co-workers etc. and then use the Adamic-Agar algorithm and preferential treatment algorithm available through the Graph Data Science plugin to test their prediction accuracy. I was wondering if it impossible to give the relationships weighting so that a friend is more important than a co-worker when the algorithm runs.

Also please inform me if there would be a better way for me to go about performing this experiment whether it would be using a different program or changing how I am thinking about the experiment.

Thanks for any help,



Hello @15onafuwadav

You can for sure add a weight property in your relations, but this will cost more time to execute your query.

Thank you @tard.gabriel for the reply

How much longer would execution take? And if not too much longer how would I go about doing it (syntax wise)?


Here with the free intro courses you can learn how to add a property to a node and a relationship and much more.

These are all the basics to introduce yourself to Neo4j, you can go further after that or even consult the neo4j cypher manuel.

Thank you very much!

Also @tard.gabriel is there a way that I can test the execution time of each algorithm I use giving a fairly precise numerical value (like syntax or software (I'm still relatively new to programming in general)).


You can learn much more than the execution time by preceding any of your Cypher query with the clause profile or explain.

For my experimentation I will take an Instagram account with roughly 50 followers and use them to create my data set (weighting mutual friends as 1 and non-mutual friends as 0.5).

I will leave some of the links undone to test they accuracy of the algorithm to see if the algorithm will fill in the blanks and use this to create a confusion matrix. However on the Graph Data Science Plugin the algorithm is shown to only be able to predict the chance of one link at a time.

Therefore my question is will I have to predict the chance of each link individually or can I have the algorithm predict all of them and rank them in terms of their score? If so how will I go about doing this?