# Quick Start

## Table of Contents

## Installation

You may install XFlow library by pip

```
pip install xflow-net
```

## The First Example

```
import xflow
from xflow.dataset.nx import BA, connSW
from xflow.dataset.pyg import Cora
from xflow.diffusion import SI, IC, LT
from xflow.seed import random as seed_random, degree as seed_degree, eigen as seed_eigen
from xflow.util import run
# graphs to test
fn = lambda: connSW(n=1000, beta=0.1)
fn.__name__ = 'connSW'
gs = [Cora, fn, BA]
# diffusion models to test
df = [SI, IC, LT]
# seed configurations to test
se = [seed_random, seed_degree, seed_eigen]
# run
# configurations of IM experiments
from xflow.method.im import pi as im_pi, degree as im_degree, sigma as im_sigma, celfpp as im_celfpp, greedy as im_greedy
me = [im_pi]
rt = run (
graph = gs, diffusion = df, seeds = se,
method = me, eval = 'im', epoch = 10,
budget = 10,
output = [ 'animation', 'csv', 'fig'])
```

## Documentation Structure

The proposed analysis framework shown above includes five factors: source node set $\Omega$, activated sub-graph $\sigma$, graph structure $G$, diffusion model $D$, and flow routing $\mathcal{F}$. A graph flow problem designates some factors as the input while some other factors act as the output, and thereby it is possible to deduce the remaining factors based on the partial factors.

Flow Tasks | Explicit Input | implicit Input | Output |
---|---|---|---|

IM | graph $G$ | diffusion $D$ | seed set $\Omega$ |

IBM | graph $G$, seed set $\Omega$ | diffusion $D$ | graph $\Delta G$ |

SL | observation $\sigma$ | graph $G$, diffusion $D$ | seed set $\Omega$ |

Diffusion Pattern | seed set $\Omega$, observation $\sigma$ | graph $G$, flow routing $\mathcal{F}$ | diffusion $D$ |

Path Study | seed set $\Omega$, observation $\sigma$ | graph $G$, diffusion $D$ | flow routing $\mathcal{F}$ |

Three tasks were implemented to demonstrate our proposed framework, including influence maximization (IM), influence blocking maximization (IBM), and source localization (SL). They are formally identified below according to the framework presented above. Table above summarizes those three and some possible future tasks that can be included in the framework, and detailed formulations are elaborated below.