Generators

ash_model.generators.random.random_hypergraph(num_nodes, size_distr, node_attrs=None, seed=None)[source]

Generates a random hypergraph with the specified number of nodes and size distribution.

Parameters:
  • num_nodes (int) – The number of nodes in the hypergraph.

  • size_distr (dict) – A dictionary where keys are hyperedge sizes and values are their probabilities.

  • seed – Optional seed for random number generation.

  • node_attrs (dict | None) –

Returns:

An ASH object representing the generated hypergraph.

Return type:

ASH

ash_model.generators.random.random_ash(num_nodes, size_distr, time_steps, node_attrs=None, seed=None)[source]

Generates a random ASH (Attributed Simple Hypergraph) with the specified number of nodes, size distribution, and time steps.

Parameters:
  • num_nodes (int) – The number of nodes in the ASH.

  • size_distr (dict) – A dictionary where keys are hyperedge sizes and values are their probabilities.

  • time_steps (int) – The number of time steps for the ASH.

  • node_attrs (dict | None) – Optional dictionary of attribute-to-values

  • seed – Optional seed for random number generation.

Returns:

An ASH object representing the generated hypergraph.

Return type:

ASH

ash_model.generators.homophily_driven.ba_with_homophily(num_nodes, m, homophily_rate, minority_size, n0, size_prob_distr=None)[source]

Generates a Barabasi-Albert hypergraph with homophily-driven connections.

Parameters:
  • num_nodes – Total number of nodes in the hypergraph.

  • m – Number of edges to attach from a new node to existing nodes.

  • homophily_rate – Probability of connecting to nodes with the same attribute.

  • minority_size – Proportion of nodes with the minority attribute.

  • n0 – Number of initial nodes to start the hypergraph.

  • size_prob_distr – Optional probability distribution for hyperedge sizes. If None, a truncated Pareto distribution is used.

Returns:

An ASH object representing the generated hypergraph.

Raises:

ValueError – If homophily_rate or minority_size is not in the range [0, 1].