Benchmark Generator

A simple demo of usage can be found here.

The library implements several benchmark generators. The aim of those benchmark is to generate both a temporal graph and a reference dynamic community structure.

Currently, two benchmarks are implemented:
  • Benchmark with custom event scenario
  • Benchmark with stable, multiple temporal scale communities

Example of custom scenario

../_images/scenario.png

Example of stable communities

../_images/stable_com.png

Benchmark with custom communities

class tnetwork.ComScenario(alpha=0.8, external_density_penalty=0.05, random_noise=0, verbose=False, variant='deterministic')[source]

This class manages the community evolution scenario

It implements the benchmark described in XXX

Behavior to keep in mind:

1) Any node that does not belong to a community is condered “dead”. Note that it can reappear later if it belongs to a community again. As a consequence, a node alive but not belonging to any community must be represented as a node belonging to a community of size 1

2)There are not really persistent community, every time a community is modified in any way, a new community is created, and it is only because they have the same name (label) that they are considered part of the same dynamic community.

As a consequence, to kill a dynamic community, one simply needs to stop using its label.

ComScenario.__init__([alpha, …]) Initialize the community generation class

Function to define events

ComScenario.INITIALIZE(sizes, labels) Function to initialize the dynamic networks with communities that already exist at the beginning
ComScenario.BIRTH(size, label, **kwargs) Creates a new community
ComScenario.DEATH(com, **kwargs) Kill a community
ComScenario.MERGE(toMerge, merged, **kwargs) Merge the communities in input into a single community with the name (label) provided in output
ComScenario.SPLIT(toSplit, newComs, sizes, …) Split a single community into several ones.
ComScenario.THESEUS(theComTh[, nbNodes, …]) Create a theseus ship operation.
ComScenario.RESURGENCE(theComTh[, death_period]) Create a resurgence operation.
ComScenario.GROW_ITERATIVE(com, nb_nodes2Add) Make a community grow node by node
ComScenario.SHRINK_ITERATIVE(com, …[, …]) Make a community shrink node by node
ComScenario.MIGRATE_ITERATIVE(comFrom, …) Make nodes of a community migrate to another one
ComScenario.ASSIGN(comsBefore, comsAfter, …) Define a custom event
ComScenario.CONTINUE(com, **kwargs) Keep a community unchanged

Run

ComScenario.run() Function to call when the scenario has been defined to actually execute it.

Toy example

This is the generator of toy examples used in the original paper.

generate_toy_random_network(**kwargs) Generate a small, toy dynamic graph
generate_simple_random_graph([nb_com, …]) Generate a simple random dynamic graph with community structure

Community class

class tnetwork.DCD.community.Community(comScenario, label=None)[source]

Class representing communities in a benchmark scenario

When generating a benchmark using the scenerio generator, communities returned by event definition functions are instances of this class.

This class has some public functions to check the names, the nodes, and the number of edges of the community. The edges themselves cannot be checked during the scenario description, since they are generated when calling the run function of the ComScenario class.

Community.label() Get the name (label) of this structure :return: name :rtype: str
Community.nodes() Get the nodes of this structure :return: list of nodes :rtype: [str]
Community.nb_intern_edges() return the number of edges expected in this community :return:

Benchmark with stable, multiple temporal scales communities

generate_multi_temporal_scale([nb_steps, …]) Generate dynamic graph with stable communities