Utils

Summary

The utils module provides various utility functions for working with ASH models, including matrix transformations, projections, and profile manipulations.

Matrices

get_hyperedge_id_mapping

Returns a mapping of hyperedge IDs to indices and vice versa.

get_node_id_mapping

Returns a mapping of node IDs to indices and vice versa.

incidence_matrix

Returns the incidence matrix of the ASH object.

incidence_matrix_by_time

Returns a dictionary of incidence matrices for each time step in the ASH object.

adjacency_matrix

Returns the adjacency matrix of the ASH object.

adjacency_matrix_by_time

Returns a dictionary of adjacency matrices for each time step in the ASH object.

Projections

clique_projection

Returns a NetworkX Graph object that is the clique projection of the given ASH object.

bipartite_projection

Returns a NetworkX Graph object that is the bipartite projection of the given ASH object.

line_graph_projection

Returns a NetworkX Graph object that is the line graph projection of the given ASH object.

dual_hypergraph_projection

The dual_hypergraph function takes a hypergraph and returns the dual of that hypergraph.

clique_projection_by_time

Returns a dictionary of NetworkX Graph objects that are the clique projections of the given ASH object for each time step.

bipartite_projection_by_time

Returns a dictionary of NetworkX Graph objects that are the bipartite projections of the given ASH object for each time step.

line_graph_projection_by_time

Returns a dictionary of NetworkX Graph objects that are the line graph projections of the given ASH object for each time step.

dual_hypergraph_projection_by_time

Returns a dictionary of dual hypergraphs for each time step in the ASH object.

Networkx Utils

from_networkx_graph

Convert an undirected NetworkX Graph into an ASH with 2-node hyperedges.

from_networkx_graph_list

Convert a sequence of NetworkX Graphs into a time­-sliced ASH.

from_networkx_maximal_cliques

Convert maximal cliques of a NetworkX Graph into an ASH.

from_networkx_maximal_cliques_list

Convert maximal cliques across time from a list of NetworkX Graphs into an ASH.

from_networkx_bipartite

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

from_networkx_bipartite_list

Time­sliced conversion of bipartite graphs into an ASH.

Profile Utils

aggregate_node_profile

Returns an aggregated profile of a node over all time points.

hyperedge_most_frequent_node_attribute_value

Returns the most frequent value of a node attribute in a hyperedge.

hyperedge_aggregate_node_profile

Returns an aggregated profile of the nodes in a hyperedge.

Details