Name: Towards AI Legal Name: Towards AI, Inc. Description: Towards AI is the world's leading artificial intelligence (AI) and technology publication. Read by thought-leaders and decision-makers around the world. Phone Number: +1-650-246-9381 Email: [email protected]
228 Park Avenue South New York, NY 10003 United States
Website: Publisher: https://towardsai.net/#publisher Diversity Policy: https://towardsai.net/about Ethics Policy: https://towardsai.net/about Masthead: https://towardsai.net/about
Name: Towards AI Legal Name: Towards AI, Inc. Description: Towards AI is the world's leading artificial intelligence (AI) and technology publication. Founders: Roberto Iriondo, , Job Title: Co-founder and Advisor Works for: Towards AI, Inc. Follow Roberto: X, LinkedIn, GitHub, Google Scholar, Towards AI Profile, Medium, ML@CMU, FreeCodeCamp, Crunchbase, Bloomberg, Roberto Iriondo, Generative AI Lab, Generative AI Lab Denis Piffaretti, Job Title: Co-founder Works for: Towards AI, Inc. Louie Peters, Job Title: Co-founder Works for: Towards AI, Inc. Louis-François Bouchard, Job Title: Co-founder Works for: Towards AI, Inc. Cover:
Towards AI Cover
Logo:
Towards AI Logo
Areas Served: Worldwide Alternate Name: Towards AI, Inc. Alternate Name: Towards AI Co. Alternate Name: towards ai Alternate Name: towardsai Alternate Name: towards.ai Alternate Name: tai Alternate Name: toward ai Alternate Name: toward.ai Alternate Name: Towards AI, Inc. Alternate Name: towardsai.net Alternate Name: pub.towardsai.net
5 stars – based on 497 reviews

Frequently Used, Contextual References

TODO: Remember to copy unique IDs whenever it needs used. i.e., URL: 304b2e42315e

Resources

Take our 85+ lesson From Beginner to Advanced LLM Developer Certification: From choosing a project to deploying a working product this is the most comprehensive and practical LLM course out there!

Publication

Understanding Social Networks
Latest

Understanding Social Networks

Last Updated on January 27, 2022 by Editorial Team

Author(s): Naveed Ahmed Janvekar

Originally published on Towards AI the World’s Leading AI and Technology News and Media Company. If you are building an AI-related product or service, we invite you to consider becoming an AI sponsor. At Towards AI, we help scale AI and technology startups. Let us help you unleash your technology to the masses.

Data Analysis

A Social Network is formed when there are a set of connections between entities (such as people or organizations) and interactions (such as friendship, contracts) between them. In today’s world, there are many social networks that existβ€Šβ€”β€Ša famous one being Facebook’s friend’s network. However, as long as we can establish connections between various entities, we can represent many things around us as a social network or a graph. Other examples of a social network can be customers writing reviews on a product – customers and products become nodes in a network and writing reviews on products become an edge. In this article, I will use social networks and graphs interchangeably.

Some basics of social networks before we get into the complexity

1. Nodesβ€Šβ€”β€ŠThese are entities within a graph such as people, products, organizations, servers

2. Edgesβ€Šβ€”β€ŠThese are connections or relationships between nodes, such as two people writing reviews on the sameΒ product

3. Weightβ€Šβ€”β€ŠThe weight of an edge is the strength of a connection. For example: if two people are connected by 10 mutual friends then the weight isΒ 10.

4. Uni-partite graphβ€Šβ€”β€ŠA network consisting of only one type ofΒ node

5. Multi-partite graphβ€Šβ€”β€ŠA network consisting of more than one type ofΒ node

6. Undirected graphβ€Šβ€”β€ŠIf there is no direction of the relationship between nodes, then the graph is said to be an undirected graph. For example, a relationship between 2Β friends.

7. Directed graphβ€Šβ€”β€ŠIf there is a direction of the relationship between nodes, then the graph is said to be directed. For example, a communication network where one entity initiatives a conversation with anotherΒ entity.

Why is it important to analyze a socialΒ network?

  1. Gives us a better understanding of how entities or individuals are connected
  2. Gives us certain measures on important entities/connections within aΒ network

3. Find similar entities based on the types of connections

4. Move beyond individual perception and analyze individuals/entities based on their connections

Let’s dive into analyzing a Social Network Analysis usingΒ Python

In order to better understand how we can leverage a graph network to our advantage, I am going to run an analysis and generate various network features on an open-source dataset.

Data source: SNAP Dataset Facebook Gemsec https://snap.stanford.edu/data/gemsec-Facebook.htmlΒ . This dataset represents blue verified Facebook page networks of different athletes. Nodes represent the pages of athletes and edges are mutual likes among them. In order to achieve anonymity nodes are indexed fromΒ 0.

Open-source packages for Social Network Analysis:

Two very popular packages that are available for analyzing social networksΒ are:

NetworkX: NetworkX is a Python package for the creation, manipulation, and study of the structure, dynamics, and functions of complex networks. https://networkx.org/

Networkit: NetworKit is a growing open-source toolkit for large-scale network analysis. Its aim is to provide tools for the analysis of large networks in the size range from thousands to billions of edges. https://networkit.github.io/

To download these packages run the following commands in the terminal:

pip3 install networkit

pip3 installΒ networkx

Below are steps that can be followed to recreate the analysis in Jupyter Notebook:

Step 1: Load dataset from SNAP repository into a Pandas DataFrame and create a graph object and printing statistics on the number of nodes andΒ edges

Step 2: Visualize the socialΒ network.

A particular challenge of a large social network is visualizing it on a screen. Hence, for the sake of this article, we will take a sample of the dataset by selecting a few nodes with a high number of connections.

Here we see that there are certain groups of nodes that are disjoint and some that are joined by a common node relationship.

Step 3: Generate Measures of SocialΒ Network

Degree Centralityβ€Šβ€”β€ŠDegree Centrality is calculated at a node level and measures the number of edges it has. Degree centrality values are normalized by dividing by the maximum possible degree in a simple graph n-1 where n is the number of nodes inΒ G.

Eigenvector Centralityβ€Šβ€”β€ŠDegree Centrality is calculated at a node level and measures the influence a node has on itsΒ network.

Local Clustering Coefficientβ€Šβ€”β€ŠThe clustering Coefficient is a measure of the degree to which nodes in a graph tend to cluster together.

Conclusion

Using network analysis to understand the connections and entities in your ecosystem can greatly help you understand the behavior of entities, the influence of these entities within your ecosystem. These network graphs can further be divided into sub-graphs to drill down into user behavior. There are many other techniques such as generating embeddings from such graphs and feeding them as features to machine learning models or even clustering network embeddings to get meaningful insights.

Sources

https://snap.stanford.edu/data/gemsec-Facebook.html

https://networkx.org/documentation/stable/index.html

https://networkit.github.io/

https://en.wikipedia.org/wiki/Social_network


Understanding Social Networks was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.

Join thousands of data leaders on the AI newsletter. It’s free, we don’t spam, and we never share your email address. Keep up to date with the latest work in AI. From research to projects and ideas. If you are building an AI startup, an AI-related product, or a service, we invite you to consider becoming aΒ sponsor.

Published via Towards AI

Feedback ↓