cypher - How to add weight as label to vertex? -


i want add weight vertex.

i have first step going in r-studio. following code gives dataframe weight:

query = " match (p)-[:refers_to]->(q)<-[:refers_to]-(r) (id(p) < id(q)) return q.name, count(q) weight order weight desc " newvalue = cypher(graph, query) 

how can weight added vertex label? following not work me because adds weight node instead of vertex:

query = " match (p)-[:refers_to]->(q)<-[:refers_to]-(r) q.name, count(q) weight set q.weight = weight " cypher(graph, query) 

thanks!

i think you're trying add weight edge (or relationship) rather node (or vertex).

in order add weight property of edge, need bind variable, , can set property before:

query = " match (p)-[r1:refers_to]->(q)<-[r2:refers_to]-(r) q.name, count(q) weight set r1.weight = weight, r2.weight = weight " cypher(graph, query) 

note can't tell of relationships want weight on, in example i'm doing both. thing here i'm binding 2 relationships r1 , r2. relationships can have properties nodes, rest straightforward.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -