Exercises
Challenge yourself with the following exercises related to the content covered in this chapter:
- Can you imagine an example of a tri-partite graph?
- Create the
RELATED_TO
relationship between movies that share at least one person (as actor or director).
Update the Cypher query we used to compute the degree distribution to obtain the normalized degree (divide by the total number of nodes in the graph).
- Can you draw the weighted degree distribution (total)?
Hint: The weighted total degree is the sum of all weights of relationships attached to a given node.
- Advanced: Can you write a Cypher query to compute the triangle count for each node?
Here is the code to create the small graph we used as an example in Neo4j:
CREATE (A:Label {id: "A"}) CREATE (B:Label {id: "B"}) CREATE (C:Label {id: "C"}) CREATE (D:Label {id: "D"}) CREATE (E:Label {id: "E"}) CREATE (A)-[:REL]->(B) CREATE...