4 Exploratory graph analysis

 

This chapter covers

  • Exploring a graph with Cypher query language
  • Aggregating data with Cypher query language
  • Using existential subqueries to filter by graph patterns
  • Using counting subqueries to count graph patterns
  • Handling query cardinality when using multiple clauses in a single Cypher statement

This chapter will teach you how to perform an exploratory data analysis of the imported Twitter social network using Cypher query language. Imagine you are working as a social media consultant and want to find as many insights as possible. As is typical with any analysis, you begin with an exploratory data analysis to get an overview of the data you are working with.

I will present how I collected the data to give you a sense of the data you will be working on in this chapter. The imported Twitter social network was retrieved using the official Twitter API. I have fetched tweets that are part of the NLP or Knowledge graph topics. At this time, I had information about tweets and users who either were mentioned or published tweets. Next, I fetched additional metadata about users in the graph, such as their registration date and follower relationships. All the users in the imported Twitter subgraph have either published a tweet or have been mentioned by one. I did not include all the followers because that would explode the graph and the network would end up consisting of a couple of million users.

4.1 Exploring the Twitter network

4.2 Aggregating data with Cypher query language

4.2.1 Time aggregations

4.3 Filtering graph patterns

4.4 Counting subqueries

4.5 Multiple aggregations in sequence

4.6 Solutions to exercises

Summary