Skip to content

A simple Python script for generating a series of network graphs based on a users connections with the wider network.

Notifications You must be signed in to change notification settings

CartographerLabs/Connections

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Connections

"Connections" is a Python tool for analyzing a social network of users. It provides the ability to add users to the network and analyze their connections and centrality measures.

Description

Connections uses the UserNetwork class to maintain a network graph for each month. Users are represented as nodes in the graph, and their interactions are represented as directed edges. There are two types of interactions: 'following' and 'mentioning' (when a user mentions another user in a post using the '@' symbol).

The class provides methods to:

  • Add a user to the network.
  • Retrieve the network graph for a specific month.
  • Retrieve the 'following' and 'mention' connections for a user in a specific month.
  • Retrieve all connections for a user in a specific month.
  • Compute centrality measures (degree, closeness, betweenness, and eigenvector centrality) for a user in a specific month.

Requirements

Connections requires Python 3 and the following Python libraries installed:

Usage

Here is an example of how to use the Connections tool:

from datetime import datetime
from connections import UserNetwork

# Create a UserNetwork instance
un = UserNetwork()

# Add a user to the network
username = "Alice"
date = datetime.now()
following = ["Bob", "Charlie"]
posts = ["Hello world!", "@Bob Hi!"]
un.add_user(username, date, following, posts)

# Get centrality measures for the user
print(un.get_centrality(username, date))

# Get connections for the user
print(un.get_connections(username, date))

About

A simple Python script for generating a series of network graphs based on a users connections with the wider network.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages