The Jupyter notebook will get the initial Neo4j graph up and running. You will need to insert credentials for the instance of Neo4j you are using. The code is work in progress, to be optimised, and I apologise in advance for the terrible code :)
If you’ve not already done so, I would suggest you get yourself a (free!) instance of Neo4j Sandbox up and running first.
Here are the queries that we will run against the graph during the session. You will need to have Neo4j Browser up and running for this.
What are the most common tags? Hints at trends
MATCH (e:Event)-->(t:Tag)
RETURN t.value, count(e) AS size ORDER BY size DESC
What CfPs are closing within the next month?
MATCH (e:Event)-->(t:Tag)
WHERE date(e.cfpClosing) < date("2021-11-01")
RETURN e.title, e.cfpClosing, e.description, collect(t.value) AS Tags
ORDER BY e.cfpClosing
Find some data science-esque conferences
WITH ['data science', 'machine learning', 'artificial intelligence', 'ai', 'ml', 'deep learning'] AS p
MATCH (l:Location)<--(e:Event)-->(t:Tag)
WHERE t.value IN p
RETURN DISTINCT e.title, e.description, l.value
Find conferences that have tags of data science and python
WITH ['data science', 'python'] AS p
MATCH (e:Event)
WHERE ALL (i in p WHERE exists((e)--(:Tag {value:i})))
RETURN e.title
Time for similarity - create a graph projection for similarity
CALL gds.graph.create.cypher("similar",
"MATCH (e:Event) RETURN id(e) AS id",
"MATCH (e1:Event)-->(t:Tag)<--(e2:Event) RETURN id(e1) AS source, id(e2) AS target")
Let’s have a look at those similar events
CALL gds.nodeSimilarity.stream("similar")
YIELD node1, node2, similarity
RETURN gds.util.asNode(node1).title, gds.util.asNode(node2).title, similarity
ORDER BY similarity desc
Let’s now connect similar events together, so that we can have a look at them
CALL gds.nodeSimilarity.stream("similar")
YIELD node1, node2, similarity
WITH gds.util.asNode(node1) AS n1, gds.util.asNode(node2) AS n2,
similarity WHERE similarity >= 0.8 AND id(n1)>id(n2)
CREATE (n1)-[:SIMILAR_TO]->(n2)
And let’s look at the result!
MATCH (e:Event)-[:SIMILAR_TO]->(e2)
WHERE NOT ()-->(e)
WITH e
MATCH (e)-[:SIMILAR_TO*]->(e1), (e)-->(t:Tag)
RETURN DISTINCT e.title, collect(distinct e1.title), collect(distinct t.value)