This is an official implementation for paper titled "DANI: Fast Diffusion Aware Network Inference with Preserving Topological Structure Property".
The default implementation of DANI is in C++, which is way faster than the python version due to C++ characteristics.
To compile the code, run the command below.
make
Only input required for the code is a file containing nodes names and cascades sorted in ascending order regarding infection timestamps. The input file contains two parts which are separated by a blank line:
-
The first
$n$ lines of the file contain the name of nodes in the network. Each line contain<id>
and<name>
where node ids are integers starting from 0 to$n-1$ .<id>,<name>
-
The next
$m$ lines contains$m$ cascades, each on a line. Each cascade is represented by a sequence of<id>
and the corresponding<timestamp>
of infection pairs where<id>
and<timestamp>
are separated by a comma and pairs are separated by a semi-colon. The cascades are sorted in ascending order regarding infection timestamps.<id>,<timestamp>;<id>,<timestamp>;<id>,<timestamp>;...;<id>,<timestamp>
An example of input file is in file cascades.txt
which contains 10000 cascades generated on the network in dataset/groundtruth/network.txt
.
Here is the list of arguments that can be passed to the code:
-i:
which is the address of input file.-Y:
which is the address of output file.
Run the code using following command:
./main -i:<input_file> -Y:<output_file>
To run the code on the example input file, run the command below:
./main -i:dataset/cascades.txt -Y:dataset/inferred/network.txt
The output of the model is in Tab Separated Triples format. Each line contains a triple in format of
DANI has also a python version. If you want to use the python version, follow the instructions in README.md in python
directory.
We use OSLOM2 [2] for the community detection. You have to download OSLOM2 and unpack it in the ./OSLOM2
and compile it to do the evaluation. You can use the script below to do these works.
wget http://www.oslom.org/code/OSLOM2.tar.gz
tar -xvzf OSLOM2.tar.gz
cd OSLOM2
chmod 744 compile_all.sh
./compile_all.sh
cd ..
Note: Compiling OSLOM may result in some errors but it is OK for our usage.
To do the evaluation, run the evaluation code as below.
cd evaluation
python3 main.py --gt <gt> --pr <pr>
Where <gt>
is a path to a directory contatining a file named network.txt
containing true underlying network and <pr>
is a path to a directory contatining a file named network.txt
containing inferred network. For example, you can use the following command to run the evaluation on the example dataset.
cd evaluation
python3 main.py --gt ../dataset/groundtruth --pr ../dataset/inferred
This code has been compiled and tested on Ubuntu 22.04 LTS using Python 3.10.
@misc{DANI,
title={{DANI}: Fast Diffusion Aware Network Inference with Preserving Topological Structure Property},
author={Maryam Ramezani and Aryan Ahadinia and Erfan Farhadi and Hamid R. Rabiee},
year={2023},
eprint={2310.01696},
archivePrefix={arXiv},
primaryClass={cs.SI}
}
We have used SNAP library and OSLOM2 to develop this method.
[1] Leskovec, J. and Sosič, R., 2016. Snap: A general-purpose network analysis and graph-mining library. ACM Transactions on Intelligent Systems and Technology (TIST), 8(1), pp.1-20.
[2] Lancichinetti, A., Radicchi, F., Ramasco, J.J. and Fortunato, S., 2011. Finding statistically significant communities in networks. PloS one, 6(4), p.e18961.