ash_model.utils.networkx.from_networkx_bipartite

ash_model.utils.networkx.from_networkx_bipartite(graph, start, end=None, keep_attrs=False)[source]

Convert a bipartite NetworkX Graph into an ASH where one node set becomes hyperedges and the other set becomes nodes. Edges connect hyperedges to their nodes.

Parameters:
  • graph (Graph) – Undirected bipartite NetworkX Graph.

  • start (int) – Start time for presence.

  • end (int | None) – Optional end time for presence.

  • keep_attrs (bool) – If True, preserves node attributes of the original graph.

Raises:

ValueError – If the graph is not bipartite.

Returns:

ASH with hyperedges corresponding to bipartite partitions.

Return type:

ASH