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
You have to run "SocialSim.py". No additional packages are required, this project only uses features that are present standard python distribution.
As you can see there are two modesin which you can use this program, details are as follow:
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:
Using this function you can create a network, there are further two more options:
If you want to load a new network from a network file you should use this option. Sample run of loading from text file:
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.
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.
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.
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
Find a friend in network
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".
Remove a friend We will remove "Rex" as a friend of "Imran khan".
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 ???)
Should I tell what this option will do ?
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
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.
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.
Done spending hours and hours on my network and now wants to go to sleep ? Use this option to exit.
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