CSCI 2270 Final Project
Brandon Eric Phillips
...simulates the spread of different kinds of information through a defined community. Using a graph to represent the community, nodes within the graph represent people and edges within the graph are directed and represent the relationships between these people. Each relationship has a type and each type of relationship has defined weights that represent the probability that a specific type of message will be shared or transferred between the two people that the relationship specifically connects. Each type of message has a default probability of transfer and an optional maximum number of times the message can be shared (in order to simulate the decay of information value in a simple way).
SocSim generates the community graph from static JSON resources files that define the possible message types, all possible relationship types, all people, and all of the relationships between people. The user can then input a message and some important meta data regarding the message and send it through the graph. Stateful information for individual messages such as who has heard the message, from whom the message came, etc. is stored in a hash table alongside the message (in what shall be called a parcel), whose data will be formatted and outputted once the message has made its go-around.
- MIT License
- Header-only library
- Bundled with SocSim in ./include/rapidjson per the permission and instruction of the project itself
- C++11-compliant version of the GCC compiler
- cmake will use the
-std=c++11flag when compiling
- cmake will use the
- Linux (probably)
- at least a shell supporting STDIN, STDOUT, and STDERR, of course
- all scripts in
./scriptsare bash scripts
- cmake (3.1+)
- python (for the Data Generator; see below)
Either of the following methods will generate the application as a binary
The easy way:
This build script cleans up
./build, runs cmake and make, and copies the executable to
./bin. Ensure you have
cmake 3.1+ already installed or this script will fail. If you get a permission error, ensure the file has executable
$ chmod +x ./scripts/*.sh
You may need to use
sudo with the above
chmod command on some distros.
Hint: there is also a
./scripts/clean.sh files that cleans up after
./scripts/clean.sh initially before compilation
Note: Both scripts assume CWD is the project root directory (NOT
The hard way:
$ rm -rf build bin $ mkdir build bin $ cd build $ cmake ../ $ make $ cp socsim ../bin/
This is essentially what the automated build script(s) do(es).
After building, SocSim can be run with the following command:
Whatever you do, in order to be able to properly import data
res must be in the current working directory.
Running SocSim will fire up the Driver (interface here and implementation here). The driver will provide a menu to the user, gather input, and output information about the society and messages and whatnot as its modified. Simply follow the prompts.
All classes are documented with JavaDoc-style Doxygen comments in their header files.
Data is stored in
./res/ in multiple JSON files. This is the data loaded into the graph initially. SocSim includes
a small graph of example data.
This representation of the graph has been exported into various formats that can be imported into many different
graph visualization tools/apps. They can be found in
The probabilities associated with the various relationship types is not stored in any of the exported representations. To view this information, use the Data Generator
Otherwise, as long as
./res/ is reachable by a web server, it should still work.
Note: There seems to be a bug in the above script so that the python server doesn't shut down when the script is
killed so you may need to you
ps -A to find it and
kill [PID] or
killall [process name] to kill it.
- @bericp1 (Brandon Phillips)
Make up data (JSON res files) Select a JSON lib Classes Society: graph; Person: node; a person with a name and occupation name; string occupation; string
Relationship: edge; * type; string (an existing
* from; string (name of
* to; string (name of
RelationshipType: qualifies and quantifies a type of relationship label; string (describes type of relationship; e.g. "married to" or "teaches" or "is a friend of") prob; map/hashtable (holds probabilities for the transfer of different message types)
MessageType: quantifies a type of message label; string (describes the type of message; e.g. "rumor" or "news") prob; float (the default probability for transfer for messages of this type)
Message Parcel: holds a
Messageand a hashtable of data about who has heard the message
Construct graph from imported data I/O controller Build hashtable on Message object to store traversal data (separate tracker class? e.g. "Parcel")