Implementation of MANCaLog: A Logic for Multi-Attribute Network Cascades.
Paper: https://arxiv.org/abs/1301.0302
Table of Contents
To run mancalog you need 3 files:
- A YAML file containing the mancalog rules
- A YAML file containing the mancalog facts
- A YAML file containing the mancalog labels
The format of these files is very important. Please refer to the example YAML files provided when making your own rules/facts/labels.
An example file is provided to illustrate how mancalog works on a subset of a Honda supply chain graph.
To run the example, clone the repository, then:
cd mancalog
python3 -m mancalog.examples.example
This example file uses the example yaml files for rules, facts and labels.
There are three ways of running MANCaLog:
- interactive session (on Agave cluster)
- sbatch (on Agave cluster)
- locally
To Run mancalog, you need to provide the following as command line arguments:
- The path to a graphml file
- The number of timesteps you want to run the diffusion
- The path to the YAML rules file
- The path to the YAML facts file
- The path to the YAML labels file
To create an Anaconda environment and activate it, and then clone the repository, type the following in your Agave terminal:
module load anaconda/py3
conda create -n mancalog
source activate mancalog
git clone https://github.com/DyumanAditya/mancalog
cd mancalog
pip install -r requirements.txt
Now create an interavtive session with:
interactive -N 1 -n 50 -p htc -t 0-0:10
This starts an interactive session using 50 cores on one node for 10 minutes. You can change the time parameter based on your needs.
To run MANCaLog, type the following in your Agave terminal. Make sure you are in the top mancalog directory. Don't forget to replace the placeholders with the correct values.
python3 -m mancalog.scripts.diffuse --graph_path /path/to/graphml/file --timesteps {number of timesteps to run} --rules_yaml_path /path/to/rules.yaml --facts_yaml_path /path/to/facts.yaml --labels_yaml_path /path/to/labels.yaml
Open the run_on_agave.sh in a text editor, and modify the paths for the graph file, the rules file, the facts file and the labels file. In addition specify the number of timesteps to run for. Then in your Agave terminal, type:
sbatch run_on_agave.sh
This will submit a job to the cluster
Clone the repository and install the necessary packages to make mancalog run
git clone https://github.com/DyumanAditya/mancalog
cd mancalog
pip install -r requirements.txt
To run MANCaLog, type the following in your Agave terminal. Make sure you are in the top mancalog directory. Don't forget to replace the placeholders with the correct values.
python3 -m mancalog.scripts.diffuse --graph_path /path/to/graphml/file --timesteps {number of timesteps to run} --rules_yaml_path /path/to/rules.yaml --facts_yaml_path /path/to/facts.yaml --labels_yaml_path /path/to/labels.yaml
To Profile the code with cProfile:
python3 -m mancalog.scripts.diffuse --graph_path /path/to/graphml/file --timesteps {integer number of timesteps to run} --rules_yaml_path /path/to/rules.yaml --facts_yaml_path /path/to/facts.yaml --labels_yaml_path /path/to/labels.yaml --profile true --profile_output output.txt