Graph Network Analysis
Tags: datascience
Published: 2022-01-11 14:07:14

## **Introduction:**
Market analysis has traditionally been the bedrock for companies for various purposes. If a company wants to;

- Launch a new product
- Check performance of an existing product
- Find new markets
- Evaluate existing markets

Market analysis is sort of an abstract layer from where you can extract trends in a demographic for certain index (topic) and co-relate with your own use-case. These co-relations can be 1:1, if your product/company seems to have competitors doing the similar thing in a market, or the company already have stakes in the market. If it is not the case, you have to extract a trend, compare it with your use-case in-terms of how much the abstracted-out trend can help you predict your own performance in that demographic/market.



**Dataset: Nashville Meetup Network**
meetup.com is a website for people organizing and attending regular or semi-regular events ("meet-ups"). The relationships amongst users—who goes to what meetups—are a social network, ideal for graph-based analysis.


**Problem Confinement:**
Examples involving a lot of factors that are super-connected must be done in graph. The rational for this is that you would find It computationally limited to run that many join operations for finding a connection and it also logically doesn’t make any sense to preserve what can easily be preserved and requires a lot of call to fetch it, with-in a data-structure.







**Loading Data in Neo4j:**
Loading Cities and States and appending relationship between them 

Loading Members and adding relation to cities they live in
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1it9nhy15c9a2cv5zg3f.png)
 
 
 
Loading Groups
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6v0linooky4j0rqie9l3.png)
 
 
Loading Categories of Groups
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gbslezo8mc7lzw3jepca.png)
 
 

Adding Group relation with each category
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ep0uioosrzops1wooiiw.png)
 
Loading Organizing Members and attaching their “Organized” relationship with “Group”.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lqdv87iqo3fl8o1a9jfz.png)
 
Loading Events and adding group as ”Conducted” which conducted that event.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xv0pksbdhr5k5nucty0q.png)
 







Loading Members that participated in Events in groups
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1rr3fg2goyuy9ws65lu6.png)
 

Loading Total Number of Members for each Group.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c1hwt5e8pcyigkkh0rhh.png)
 
Visualizing Graph Schema:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/96b2eqvw7u67fxshot30.png)


 
“””
**_I have added members relationship to Group I both directions because that will make DB calls much more optimized when going left or right from members_**
“””

**

## Querying:
**
Let's check which group category has the most members
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5ms0tzr9nu6osmx8bvgj.png)
 

Finding trends for cities (‘Franklin’)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p4hj9vlqps0wor37qord.png)
 

Let’s find the groups with name ‘Cars & Motorcycles’ across all cities.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/55dpglkzhz9flxp5qin5.png)
 
Finding number of events per city:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sj152xhohs3rel6bo74y.png)
 
Finding ‘Tech’ events hosted by all of the cities:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sm02htsz2gsl9p6tgl1i.png)
 





**

## Visual Inspection:
**
Let explore Categories of Groups; Games, Dancing and Education and see how many groups do they have
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ag34dp6sdluvrvhyhaqk.png)
 


Let’s follow a trail for a particular group like ‘GEEK by AKEIN Engineering’ in Education.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tpop45qx1ya01k2munf5.png)
 


We can see the ‘Members’ associated with group, Events done for this group and the organizer of this group as well.

Let’s pick a random person and see in which ‘City’ he lives.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/msiqf8h1e4ffscnwobiq.png)
 

So, this person lives in Nashville and share this location with 3 other group members as well.


**

## Ending note:
**
With Graph technology, we can find the trends visually as well as programmatically. The bottom line is that preserving the connections within the structure is much more important. We can do trailing queries and segment our problem in areas we need and connect these links when needed for a particular use-case.