Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
05-26-2019 12:21 PM
Hi,
I was trying my hands on graph algorithms. I have a graph with multiple labels and different relationships between them. For example, I have two labels "Person" and "Company" and different relationships between company to company and person to the company. labels. I want to run the Triangle Counting / Clustering Coefficient on this graph using "cypher projection". Please suggest how this can be achieved. In the example, I can see a single relationship. What if I want to include two different relationships.
ALL algo.triangleCount(
'MATCH (p:Person) RETURN id(p) as id',
**'MATCH (p1:Person)-[:KNOWS]->(p2:Person) RETURN id(p1) as source,id(p2) as target',**
{concurrency:4, write:true, writeProperty:'triangle',graph:'cypher', clusteringCoefficientProperty:'coefficient'})
YIELD loadMillis, computeMillis, writeMillis, nodeCount, triangleCount, averageClusteringCoefficient
Thanks,
Saurabh
06-27-2019 07:04 AM
If you want to match on multiple relationships, you can do so using |
like so.
[:KNOWS|OTHER_RELATIONSHIP]
will match on either of the two relationships.
If you want an AND
- where both relationships are true, you can match like so
MATCH (node)-[:KNOWS]-(node2), (node)-[:OTHER_RELATIONSHIP]-(node3)
Hope this helps!
All the sessions of the conference are now available online