Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
08-23-2022 02:57 PM - edited 08-23-2022 03:24 PM
My graph has node types: Provider, Diagnosis, Procedure (and more). I want to derive or calculate node centrality for all nodes: degree, pagerank, and eigenvector centralities.
My starting methodology is as follows:
- create a graph projection
- apply the gds degree centrality on the graph projection to get the centrality for each node.
Here is what I'm having trouble with:
`query ='''CALL gds.graph.project('mygraph', myNodes, myLinks)'''`
where my myNodes is:
'MATCH (n) where n:Provider or n.Diagnosis return id(n) as id',
where myLinks is:
` match (s:Provider)-[r:PROVIDES_DIAGNOSIS]-(t:Diagnosis) where r.some_ratio > 0 return id(s) as src, id(t) as trg, r.some_ratio as weight',
Then I want to apply degree.stream:
CALL gds.degree.stream( 'mygraph')
YIELD nodeId, score
RETURN gds.util.asNode(nodeId).provider_id as provider, score
order by score desc'''
Here is the error message ```
{message: Failed to invoke procedure `gds.graph.project`: Caused by: java.lang.IllegalArgumentException: Invalid node projection, one or more labels not found: 'match (n) where n:Diagnosis or n:Provider return id(n) as id'}
```query = """ CALL gds.graph.project(
'mygraph',
'match (n) where n:Diagnosis or n:Provider return id(n) as id',
'MATCH(n:Provider)-[r]-(m:Diagnosis) where r.claims_ratio_float > 0 RETURN id(n) as source, id(m) as target, r.claims_ratio_float as weight',
{relationshipProperties: 'weight'}
)"""
result = session.run(query)`
The query is incorrect, but I can't figure a fix to this query.
08-23-2022 03:01 PM - edited 08-23-2022 03:02 PM
by itself, this query works: `
08-23-2022 03:14 PM
An other option I found, is to use :
CALL gds.pageRank.stream({
nodeQuery:'MATCH (p) WHERE p:Provider or p:Diagnosis
RETURN id(i) as id',
relationshipQuery: match (s)-[r:REFERS_RULE_CODE]-(t) where r.risk_score > 0 return id(s)
as source, id(t) as target, r.risk_score as weight
union all
match (s)-[r:PROVIDED_DIAGNOSIS_1]-(t) where r.claims_ratio_float > 0 return id(s) as source,
id(t) as target, r.claims_ratio_float as weight'
relationshipWeightProperty:'weight'})
YIELD nodeId, score
08-23-2022 03:42 PM
It looks like (form the docs) that another way to project my graph is to:
`
All the sessions of the conference are now available online