Does anyone have any tips on creating a network graph of interactions across a Discourse instance? For example, to be able to gauge the relative size of groups, how they relate to each other, who are the “most connected” people (by likes etc), all visualised in a network graph?
I’m guessing the requires a third-party service like
flourish so if anyone has any expertise in creating graphs that would be useful too!
Thanks in advance!
If I were going to do this I would
Pull down a backup of the site and load it into a
PostgreSQL database; PostgreSQL is the database backing Discourse. ( ref)
NoSQL database, specifically Neo4j, from the PostgreSQL data. ( ref)
Use the Neo4j query language
Cypher to find the realtionships.
Neo4j has a
sandbox, you might find the Panama Papers example of interest.
Once the Neo4j database is up an working to keep the Neo4j database in sync with the Discourse PostgreSQL database I would use
b. Discourse webhooks
I did one on Flourish last week. It’s based on this example that no longer works because Google discontinued their network fusion chart.
Thanks to the
Data Explorer Plugin and the query that @riking created, we have a great visualization of the interaction in our instance.
You can also play with it.
It’s easy to do it:
1 - Install Data Explorer plugin
2 - Run the riking query or an modified version of it.
We use a version that only extracts from a specific groupWITH pairs AS (
SELECT p.user_id liked, pa.user_id liker
FROM post_actions pa
LEFT JOIN posts p ON p.id = pa.post_id
likes between users in both directions
colours to highlight groups
thickness of lines to show the number of likes
bubble size to show the like ratio for each user (posts/likes)
My example has so many data points it’s difficult to read but I was just experimenting with it anyway. Reducing the number of users or the time period etc would make it cleaner.
Screenshot of selected user below:
I built this as an online visualisation:
Community Network Visualisation