Git Product home page Git Product logo

social-network-simulator's Introduction

Social-Network-Simulator

A man once said:

If you want to learn a new language start with simple syntax ans then implement Data Structures in that language

Well, that's what I was doing when I dived into python. I started implementing list, linked list, graph etc. I wanted to develop a project that will use all these concepts, so that I can develop better understanding of these concepts. Ever thought how Facebook, Linked-in, Instagram worked? Well, I have and that's what I wanted to develop.

This project simulates a "Social Network", where you can:

  • Make friends
  • Follow and un-follow people
  • Create, like and delete posts

How to run?

You have to run "SocialSim.py". No additional packages are required, this project only uses features that are present standard python distribution.

usage

As you can see there are two modesin which you can use this program, details are as follow:

Interactive mode

In this mode, user can interact with the program and will have to provide input at each step as he/she wants, this is how a interactive mode looks like:

intr

Load Network

Using this function you can create a network, there are further two more options:

load

Load new network

If you want to load a new network from a network file you should use this option. Sample run of loading from text file:

load new network

As you can see the network is loaded when we print the network it prints as expected. Remember Format of the network input should be exactly same as the network.txt file that is provided.

Load saved network

If you have created a network and made some changes, saved the network using Save network. You can load the graph from the saved pickle file.

saved

Set Probabilities

It is probability in percentage(%), that how much likely a person will follow another person, or much likely a person will like the post. If you think this application as a "Disease spread simulation", this parameter will mean that how much is likely for a healthy person get affected by the disease.

pro

Node Operations

As the graph is a linked-list of a linked-lists, so, A node is representing a person in the network. If you want to:

Sign-up in the network

insert

Get removed from the network delete

Find a friend in network

found

Edge Operations

Edge represent a connection between various persons in the network. If you want to:

Add a friend We will make "Rex" a friend of "Imran khan". add

Remove a friend We will remove "Rex" as a friend of "Imran khan". remov

New Post

Its just like making a new post and publishing it. Now, how many will like this post and how many will follow the person in return, depends on the Probabilities we set earlier (remember ???) post

Display Network

Should I tell what this option will do ? display

Display Statistics

This option will display various stats like:

  • Number of posts made by a person
  • Post ordered by their popularity
  • Number of likes, friends, friends of etc

stata

Update

As we are in simulation mode, we have to update the network manually. What does this update means? You have created a post, now people will start liking the post as you update the network. In other terms, it is a mean of progressing through time. update

Save Network

You have made changes to your network and wants to save the network for future use, don't worry I got you covered. Use this option to save the network as a pickle file. optn 9

Exit

Done spending hours and hours on my network and now wants to go to sleep ? Use this option to exit.

Simulation mode

You don't have time to manually create posts, follow, unfollow people and want to automate things. Use events.txt to save all the events and run a simulation on them. Events file can have events of adding a friend, removing a friend, posting, liking etc. See the events.txt for more information. Remember Your events file should be in same format as the given events.txt

Once you have run the simulation a Simulation_Log.txt file will appear that will contains various stats and other logs sim

social-network-simulator's People

Contributors

zain-bin-arshad avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

rusal84

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.