# Creating Network Graphs

**URL:** https://meta.discourse.org/t/creating-network-graphs/153311
**Category:** Data & reporting
**Tags:** sql-query
**Created:** [May 30, 2020, 12:27pm UTC](https://meta.discourse.org/t/creating-network-graphs/153311 "2020-05-30T12:27:01Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Conor\_McCarthy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/conor_mccarthy/32/180128_2.png) [@Conor\_McCarthy](https://meta.discourse.org/u/Conor_McCarthy)
#### Post date: [May 30, 2020, 12:27pm UTC](https://meta.discourse.org/t/creating-network-graphs/153311/1 "2020-05-30T12:27:01Z")

</div>

Hi all,

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](https://app.flourish.studio/) so if anyone has any expertise in creating graphs that would be useful too!

Thanks in advance!

---

<div class="post-metadata">

### Author: ![EricGT](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@EricGT](https://meta.discourse.org/u/EricGT)
#### Post date: [May 30, 2020, 12:38pm UTC](https://meta.discourse.org/t/creating-network-graphs/153311/2 "2020-05-30T12:38:43Z")

</div>

If I were going to do this I would

1. Pull down a backup of the site and load it into a [PostgreSQL](https://www.postgresql.org/) database; PostgreSQL is the database backing Discourse. ([ref](https://meta.discourse.org/t/how-to-export-data-for-analysis/43395))

2. Create a [NoSQL](https://en.wikipedia.org/wiki/NoSQL) database, specifically [Neo4j](https://neo4j.com/), from the PostgreSQL data. ([ref](https://neo4j.com/developer/guide-importing-data-and-etl/))

3. Use the Neo4j query language [Cypher](https://neo4j.com/cypher-graph-query-language/) to find the realtionships.

Neo4j has a [sandbox](https://neo4j.com/sandbox/), you might find the [Panama Papers](https://en.wikipedia.org/wiki/Panama_Papers) example of interest.

* * *

**EDIT**

Once the Neo4j database is up an working to keep the Neo4j database in sync with the Discourse PostgreSQL database I would use **either**

a. PostgreSQL [triggers](https://www.postgresql.org/docs/current/triggers.html)  
b. Discourse [webhooks](https://meta.discourse.org/t/setting-up-webhooks/49045)

---

<div class="post-metadata">

### Author: ![thefreekick](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thefreekick/32/43228_2.png) [@thefreekick](https://meta.discourse.org/u/thefreekick)
#### Post date: [May 31, 2020, 8:22am UTC](https://meta.discourse.org/t/creating-network-graphs/153311/3 "2020-05-31T08:22:28Z")

</div>

I did one on Flourish last week. It’s based on this example that no longer works because Google discontinued their network fusion chart.

> [@Create a Network chart of your forum - data visualization](https://meta.discourse.org/t/network-chart-of-your-forum-data-visualization/37426):
>
> Thanks to the [Data Explorer Plugin](https://meta.discourse.org/t/data-explorer-plugin/32566) and the query that @riking created, we have a great visualization of the interaction in our discourse instance. [[image]](http://bit.ly/1O6vDyv) You can also [play with it](http://bit.ly/1O6vDyv). It’s easy to do it: 1 - Install [Data Explorer](https://meta.discourse.org/t/32566?silent=true) plugin 2 - Run the riking query or an modified version of it.play_button We use a version that only extracts from a specific groupplay_button You could do it another modified version of the SQL query that filter by period 3 - Download the .csv 4 - Create a [Fusion Table](https://www.google.com/fusiontables/data?dsrcid=implicit)5 - Upload the .…

It’s showing

- 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.

> **[TFK Network](https://public.flourish.studio/visualisation/2520157/)**
>
> A Flourish data visualisation by Rocko

Screenshot of selected user below:

 ![image](https://global.discourse-cdn.com/meta/original/3X/7/a/7a4c540c247fad22b5babed12a3ebea0f5900619.jpeg)

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [April 29, 2021, 4:02pm UTC](https://meta.discourse.org/t/creating-network-graphs/153311/5 "2021-04-29T16:02:00Z")

</div>

I built this as an online visualisation: [Community Network Visualisation](https://meta.discourse.org/t/community-network-visualisation/184189)
