Quick Start

Table of Contents


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

Analysis Framework
Analysis Framework

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 TasksExplicit Inputimplicit InputOutput
IMgraph $G$diffusion $D$seed set $\Omega$
IBMgraph $G$, seed set $\Omega$diffusion $D$graph $\Delta G$
SLobservation $\sigma$graph $G$, diffusion $D$seed set $\Omega$
Diffusion Patternseed set $\Omega$, observation $\sigma$graph $G$, flow routing $\mathcal{F}$diffusion $D$
Path Studyseed 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.

  • Task

    List of Benchmark Tasks

  • Diffusion

    Introduction to diffusion models

  • Graph

    Introduction to graphs data.

  • Resources

    Introduction to related coding resources.