groundtruth_generator

This module generates a complete benchmark.

class Groundtruth(tcommlist, graphs, events)

Bases: object

This class represents a temporal network and its communities.

Parameters:
  • tcommlist (Tcommlist) –

  • graphs (Dict[int, Graph]) – networkx graph for each snapshot

  • events (List[Event]) – community events

Attr membership:

events: List[Event]
graphs: Dict[int, Graph]
tcommlist: Tcommlist
class GroundtruthGenerator(community_generator=None, node_generator=None, edge_generator=None, seed=None)

Bases: IGenerator

This class defines a complete benchmark generator.

Parameters:
  • community_generator (Optional[CommunitiesGenerator]) – community flow graph generator, CommunitiesGenerator with default arguments if not provided

  • node_generator (Optional[RandomMemberGenerator]) – membership generator, new RandomMemberGenerator instance if not provided

  • edge_generator (Optional[IStaticGraphGenerator]) – snapshot network graphs generator, BPAM with default arguments if not provided

  • seed (Optional[Any]) –

Note

seed attributes of each step generator will be replaced by a new one spwaned from seed.

configure_seed(seed)

Set :attr`seed` and :attr`rng`.

Parameters:

seed (Any) –

Returns:

instance generator

copy()

Return a copy of generator.

Return type:

Self

Returns:

generate()

Generate complete benchmark.

Return type:

Groundtruth

Returns:

groundtruth

generate_clusters(communities)

Generate clusters of members for each time step.

Returns:

list of the clusters for each time step as a tcommlist

Return type:

dyn.core.communities.Tcommlist

generate_communities()

Generate evolving communities.

Returns:

evolving communities

Return type:

dyn.core.community_graphs.EvolvingCommunity

generate_events(tcommlist)

Generate groundtruth events from tcommlist.

Event types are the following:

  • birth

  • continuation

  • death

Parameters:

tcommlist

Returns:

groundtruth events

generate_graphs(tcommlist)

Generate graphs for each time step.

Returns:

list of timesteps and corresponding graphs

Return type:

tuple

property rng: Generator

Random number generator of the generator

Return type:

Generator

property seed: SeedSequence

Seed of the generator

Return type:

SeedSequence

spawn(n_children=1)

Spawn a copy of the generated with a child seed.

Return type:

Union[Sequence[Self], Self]

Returns:

new generator

class ProgressiveGroundtruthGenerator(community_generator=None, node_generator=None, edge_generator=None, seed=None)

Bases: GroundtruthGenerator

This class defines a complete benchmark generator.

Its particularity is to integrate a progress bar from package alive-progress and display the progress of each step.

Parameters:
  • community_generator (Optional[CommunitiesGenerator]) – community flow graph generator, CommunitiesGenerator with default arguments if not provided

  • node_generator (Optional[RandomMemberGenerator]) – membership generator, new RandomMemberGenerator instance if not provided

  • edge_generator (Optional[IStaticGraphGenerator]) – snapshot network graphs generator, BPAM with default arguments if not provided

  • seed (Optional[Any]) –

Note

  • seed attributes of each step generator will be replaced by a new one spwaned from seed.

  • if the alive-progress package is not installed, this generator is no different from GroundtruthGenerator.

configure_seed(seed)

Set :attr`seed` and :attr`rng`.

Parameters:

seed (Any) –

Returns:

instance generator

copy()

Return a copy of generator.

Return type:

Self

Returns:

generate()

Generate complete benchmark.

Return type:

Groundtruth

Returns:

groundtruth

generate_clusters(communities)

Generate clusters of members for each time step.

Returns:

list of the clusters for each time step as a tcommlist

Return type:

dyn.core.communities.Tcommlist

generate_communities()

Generate evolving communities.

Returns:

evolving communities

Return type:

dyn.core.community_graphs.EvolvingCommunity

generate_events(tcommlist)

Generate groundtruth events from tcommlist.

Event types are the following:

  • birth

  • continuation

  • death

Parameters:

tcommlist

Returns:

groundtruth events

generate_graphs(tcommlist)

Generate graphs for each time step.

Returns:

list of timesteps and corresponding graphs

Return type:

tuple

property rng: Generator

Random number generator of the generator

Return type:

Generator

property seed: SeedSequence

Seed of the generator

Return type:

SeedSequence

spawn(n_children=1)

Spawn a copy of the generated with a child seed.

Return type:

Union[Sequence[Self], Self]

Returns:

new generator