DYMOND.sampling package

Submodules

DYMOND.sampling.generate_dynamic_graph module

DYMOND.sampling.generate_dynamic_graph.create_igraph(gen_data, gen_data_dir)[source]

Create igraph.Graph object

Parameters
  • gen_data (dict) – generated graph data

  • gen_data_dir (str) – directory for generated graph

DYMOND.sampling.generate_dynamic_graph.dymond_generate(dataset_dir, num_timesteps)[source]

Run graph generation

Parameters
  • dataset_dir (str) – dataset directory

  • dataset_name (str) – dataset name

  • num_timesteps (int) – number of timesteps to generate

DYMOND.sampling.generate_dynamic_graph.estimate_motif_type_probs(triplets, role_distr, t)[source]

Estimate motif type probabilities for active triplets at time t.

Parameters
  • triplets (list) – new active triplets at time t

  • role_distr (dict) – node role probabilities

  • t (int) – timestep

Returns

motif type probabilities

Return type

dict

DYMOND.sampling.generate_dynamic_graph.generate_dynamic_graph(num_timesteps, length_timestep, num_nodes, node_rate, motif_props, role_distr, role_counts, type_counts, motif_type_rates, gen_data_dir)[source]

Generate dynamic graph.

Parameters
  • num_timesteps (int) – number of timesteps to generate

  • length_timestep (int) – length of time

  • num_nodes (int) – number of nodes

  • node_rate (dict) – node arrival rate

  • motif_props (dict) – motif type proportions

  • role_distr (dict) – node role probabilities

  • role_counts (dict) – node role counts

  • type_counts (dict) – motif type counts

  • motif_type_rates (dict) – motif type inter-arrival rates

  • gen_data_dir (str) – directory for generated graph

Returns

generated graph data

Return type

dict

DYMOND.sampling.generate_dynamic_graph.get_active_nodes(num_timesteps, length_timestep, num_nodes, node_rate, gen_dir)[source]

Get active notes.

Parameters
  • num_timesteps (int) – number of timesteps

  • length_timestep (int) – length of timestep

  • num_nodes (int) – number of nodes

  • node_rate (dict) – node arrival rate

  • gen_dir (str) – directory for graph generation

Returns

active nodes per timestep

Return type

list

DYMOND.sampling.generate_dynamic_graph.get_active_triplets(new_nodes, old_nodes, t)[source]
DYMOND.sampling.generate_dynamic_graph.get_directories_generated_graph(dataset_dir)[source]

Get directories for model parameters and generated graph.

Parameters

dataset_dir (str) – dataset directory

Returns

directories for model parameters and generated graph

Return type

str, str

DYMOND.sampling.generate_dynamic_graph.get_generated_graph_data(gen_data_dir, num_timesteps, model_params)[source]

Generate graph data.

Parameters
  • dataset_dir (str) – dataset directory

  • num_timesteps (int) – number of timesteps to generate

  • model_params (dict) – model parameters

Returns

generated graph data

Return type

dict

DYMOND.sampling.generate_dynamic_graph.get_motif_edges(motifs, motif_types, roles_motifs, roles_assigned, t, gen_dir)[source]

Get motif edges

Parameters
  • motifs (list) – motifs

  • motif_types (dict) – motif types

  • roles_motifs (dict) – node roles

  • roles_assigned (dict) – node roles assigned counts

  • t (int) – timestep

  • gen_dir (str) – directory for generated graph

Returns

motif edges, node roles assigned

Return type

dict, dict

DYMOND.sampling.generate_dynamic_graph.get_parameters(params_dir)[source]

Get model parameters

Parameters

params_dir (str) – parameters directory

Returns

model parameters

Return type

dict

DYMOND.sampling.generate_dynamic_graph.get_role_distr(gen_dir, model_params)[source]

Get node role probabilities

Parameters
  • gen_dir (str) – directory for generated graph

  • model_params (dict) – model parameters

Returns

node role probabilities

Return type

dict

DYMOND.sampling.generate_dynamic_graph.helper_estimate_motif_type_probs(role_distr, motif, motif_type)[source]
DYMOND.sampling.generate_dynamic_graph.helper_get_active_triplets(new_nodes, old_nodes, t, gen_dir, motifs_t)[source]
DYMOND.sampling.generate_dynamic_graph.sample_motif_timesteps(num_timesteps, motifs, motif_type, motif_type_rates, t, gen_dir)[source]

Sample timesteps that the motifs will appear in.

Parameters
  • num_timesteps (int) – number of timesteps to generate

  • motifs (dict) – motifs

  • motif_type (dict) – motif types

  • motif_type_rates (dict) – motif type inter-arrival rates

  • t (int) – timestep

  • gen_dir (str) – directory for generated graph

Returns

motif timesteps and inter-arrival rates

Return type

dict, dict

DYMOND.sampling.generate_dynamic_graph.sample_motifs(new_nodes, old_nodes, motif_props, role_distr, role_counts, node_roles_assigned, type_counts, motif_type_rates, t, num_timesteps, gen_dir)[source]

Sample motifs from new active triplets at time t.

Parameters
  • new_nodes (list) – new active nodes

  • old_nodes (list) – previous active nodes

  • motif_props (dict) – motif type proportions

  • role_distr (dict) – node role probabilities

  • role_counts (dict) – node role counts

  • node_roles_assigned (dict) – node roles assigned

  • type_counts (dict) – node motif type counts

  • motif_type_rates (dict) – motif type inter-arrival rates

  • t (int) – timestep

  • num_timesteps (int) – number of timesteps

  • gen_dir (str) – directory for generated graph

Returns

data for motifs sampled at time t

Return type

dict

DYMOND.sampling.generate_dynamic_graph.sample_node_roles(motifs, motif_type, motif_timesteps, role_distr, role_counts, gen_dir, gen_dir_t, t)[source]

Sample node roles for motifs

Parameters
  • motifs (list) – motifs

  • motif_type (dict) – motif types

  • motif_timesteps (dict) – timesteps motifs appear in

  • role_distr (dict) – node role probabilities

  • role_counts (dict) – node role counts

  • gen_dir (str) – directory for generated graph

  • gen_dir_t (str) – directory for graph snapshot t

  • t (int) – timestep

Returns

node role probabilities, counts and roles in motifs

Return type

dict, dict, dict

DYMOND.sampling.generate_dynamic_graph.update_role_counts(role_counts, u, role_u, motif_timesteps)[source]

Update node role counts

Parameters
  • role_counts (dict) – node role counts

  • u (int) – node to update counts for

  • role_u (str) – node u’s role

  • motif_timesteps (list) – timesteps motif appears in

Returns

updated role counts

Return type

dict

DYMOND.sampling.generate_dynamic_graph.update_role_distr(nodes, role_distr, role_counts, gen_dir, t, gen_dir_t=None)[source]

Update node role probabilities

Parameters
  • nodes (list) – nodes

  • role_distr (dict) – node role probabilities

  • role_counts (dict) – node role counts

  • gen_dir (str) – directory for generated graph

  • t (int) – timestep

  • gen_dir_t (str) – directory for generated graph snapshot t

Returns

updated node role probabilities

Return type

dict

Module contents