reports package

Submodules

reports.descriptive_stats module

This module contains methods which compute various distributions for hypergraphs:
  • Edge size distribution

  • Node degree distribution

  • Component size distribution

  • Toplex size distribution

  • Diameter

Also computes general hypergraph information: number of nodes, edges, cells, aspect ratio, incidence matrix density

reports.descriptive_stats.centrality_stats(X)[source]

Computes basic centrality statistics for X

Parameters:

X – an iterable of numbers

Returns:

[min, max, mean, median, standard deviation] – List of centrality statistics for X

Return type:

list

reports.descriptive_stats.comp_dist(H, aggregated=False)[source]

Computes component sizes, number of nodes.

Parameters:
  • H (Hypergraph) –

  • aggregated – If aggregated is True, returns a dictionary of component sizes (number of nodes) and counts. If aggregated is False, returns a list of components sizes in H.

Returns:

comp_dist – List of component sizes or dictionary of component size distribution

Return type:

list or dictionary

See also

s_comp_dist

reports.descriptive_stats.degree_dist(H, aggregated=False)[source]

Computes degrees of nodes of a hypergraph.

Parameters:
  • H (Hypergraph) –

  • aggregated – If aggregated is True, returns a dictionary of degrees and counts. If aggregated is False, returns a list of degrees in H.

Returns:

degree_dist – List of degrees or dictionary of degree distribution

Return type:

list or dict

reports.descriptive_stats.dist_stats(H)[source]

Computes many basic hypergraph stats and puts them all into a single dictionary object

  • nrows = number of nodes (rows in the incidence matrix)

  • ncols = number of edges (columns in the incidence matrix)

  • aspect ratio = nrows/ncols

  • ncells = number of filled cells in incidence matrix

  • density = ncells/(nrows*ncols)

  • node degree list = degree_dist(H)

  • node degree dist = centrality_stats(degree_dist(H))

  • node degree hist = Counter(degree_dist(H))

  • max node degree = max(degree_dist(H))

  • edge size list = edge_size_dist(H)

  • edge size dist = centrality_stats(edge_size_dist(H))

  • edge size hist = Counter(edge_size_dist(H))

  • max edge size = max(edge_size_dist(H))

  • comp nodes list = s_comp_dist(H, s=1, edges=False)

  • comp nodes dist = centrality_stats(s_comp_dist(H, s=1, edges=False))

  • comp nodes hist = Counter(s_comp_dist(H, s=1, edges=False))

  • comp edges list = s_comp_dist(H, s=1, edges=True)

  • comp edges dist = centrality_stats(s_comp_dist(H, s=1, edges=True))

  • comp edges hist = Counter(s_comp_dist(H, s=1, edges=True))

  • num comps = len(s_comp_dist(H))

Parameters:

H (Hypergraph) –

Returns:

dist_stats – Dictionary which keeps track of each of the above items (e.g., basic[‘nrows’] = the number of nodes in H)

Return type:

dict

reports.descriptive_stats.edge_size_dist(H, aggregated=False)[source]

Computes edge sizes of a hypergraph.

Parameters:
  • H (Hypergraph) –

  • aggregated – If aggregated is True, returns a dictionary of edge sizes and counts. If aggregated is False, returns a list of edge sizes in H.

Returns:

edge_size_dist – List of edge sizes or dictionary of edge size distribution.

Return type:

list or dict

reports.descriptive_stats.info(H, node=None, edge=None)[source]

Print a summary of simple statistics for H

Parameters:
  • H (Hypergraph) –

  • obj (optional) – either a node or edge uid from the hypergraph

  • dictionary (optional) – If True then returns the info as a dictionary rather than a string If False (default) returns the info as a string

Returns:

info – Returns a string of statistics of the size, aspect ratio, and density of the hypergraph. Print the string to see it formatted.

Return type:

string

reports.descriptive_stats.info_dict(H, node=None, edge=None)[source]

Create a summary of simple statistics for H

Parameters:
  • H (Hypergraph) –

  • obj (optional) – either a node or edge uid from the hypergraph

Returns:

info_dict – Returns a dictionary of statistics of the size, aspect ratio, and density of the hypergraph.

Return type:

dict

reports.descriptive_stats.s_comp_dist(H, s=1, aggregated=False, edges=True, return_singletons=True)[source]

Computes s-component sizes, counting nodes or edges.

Parameters:
  • H (Hypergraph) –

  • s (positive integer, default is 1) –

  • aggregated – If aggregated is True, returns a dictionary of s-component sizes and counts in H. If aggregated is False, returns a list of s-component sizes in H.

  • edges – If edges is True, the component size is number of edges. If edges is False, the component size is number of nodes.

  • return_singletons (bool, optional, default=True) –

Returns:

s_comp_dist – List of component sizes or dictionary of component size distribution in H

Return type:

list or dictionary

See also

comp_dist

reports.descriptive_stats.s_edge_diameter_dist(H)[source]
Parameters:

H (Hypergraph) –

Returns:

s_edge_diameter_dist – List of s-edge-diameters for hypergraph H starting with s=1 and going up as long as the hypergraph is s-edge-connected

Return type:

list

reports.descriptive_stats.s_node_diameter_dist(H)[source]
Parameters:

H (Hypergraph) –

Returns:

s_node_diameter_dist – List of s-node-diameters for hypergraph H starting with s=1 and going up as long as the hypergraph is s-node-connected

Return type:

list

reports.descriptive_stats.toplex_dist(H, aggregated=False)[source]

Computes toplex sizes for hypergraph H.

Parameters:
  • H (Hypergraph) –

  • aggregated – If aggregated is True, returns a dictionary of toplex sizes and counts in H. If aggregated is False, returns a list of toplex sizes in H.

Returns:

toplex_dist – List of toplex sizes or dictionary of toplex size distribution in H

Return type:

list or dictionary

Module contents

reports.centrality_stats(X)[source]

Computes basic centrality statistics for X

Parameters:

X – an iterable of numbers

Returns:

[min, max, mean, median, standard deviation] – List of centrality statistics for X

Return type:

list

reports.comp_dist(H, aggregated=False)[source]

Computes component sizes, number of nodes.

Parameters:
  • H (Hypergraph) –

  • aggregated – If aggregated is True, returns a dictionary of component sizes (number of nodes) and counts. If aggregated is False, returns a list of components sizes in H.

Returns:

comp_dist – List of component sizes or dictionary of component size distribution

Return type:

list or dictionary

See also

s_comp_dist

reports.degree_dist(H, aggregated=False)[source]

Computes degrees of nodes of a hypergraph.

Parameters:
  • H (Hypergraph) –

  • aggregated – If aggregated is True, returns a dictionary of degrees and counts. If aggregated is False, returns a list of degrees in H.

Returns:

degree_dist – List of degrees or dictionary of degree distribution

Return type:

list or dict

reports.dist_stats(H)[source]

Computes many basic hypergraph stats and puts them all into a single dictionary object

  • nrows = number of nodes (rows in the incidence matrix)

  • ncols = number of edges (columns in the incidence matrix)

  • aspect ratio = nrows/ncols

  • ncells = number of filled cells in incidence matrix

  • density = ncells/(nrows*ncols)

  • node degree list = degree_dist(H)

  • node degree dist = centrality_stats(degree_dist(H))

  • node degree hist = Counter(degree_dist(H))

  • max node degree = max(degree_dist(H))

  • edge size list = edge_size_dist(H)

  • edge size dist = centrality_stats(edge_size_dist(H))

  • edge size hist = Counter(edge_size_dist(H))

  • max edge size = max(edge_size_dist(H))

  • comp nodes list = s_comp_dist(H, s=1, edges=False)

  • comp nodes dist = centrality_stats(s_comp_dist(H, s=1, edges=False))

  • comp nodes hist = Counter(s_comp_dist(H, s=1, edges=False))

  • comp edges list = s_comp_dist(H, s=1, edges=True)

  • comp edges dist = centrality_stats(s_comp_dist(H, s=1, edges=True))

  • comp edges hist = Counter(s_comp_dist(H, s=1, edges=True))

  • num comps = len(s_comp_dist(H))

Parameters:

H (Hypergraph) –

Returns:

dist_stats – Dictionary which keeps track of each of the above items (e.g., basic[‘nrows’] = the number of nodes in H)

Return type:

dict

reports.edge_size_dist(H, aggregated=False)[source]

Computes edge sizes of a hypergraph.

Parameters:
  • H (Hypergraph) –

  • aggregated – If aggregated is True, returns a dictionary of edge sizes and counts. If aggregated is False, returns a list of edge sizes in H.

Returns:

edge_size_dist – List of edge sizes or dictionary of edge size distribution.

Return type:

list or dict

reports.info(H, node=None, edge=None)[source]

Print a summary of simple statistics for H

Parameters:
  • H (Hypergraph) –

  • obj (optional) – either a node or edge uid from the hypergraph

  • dictionary (optional) – If True then returns the info as a dictionary rather than a string If False (default) returns the info as a string

Returns:

info – Returns a string of statistics of the size, aspect ratio, and density of the hypergraph. Print the string to see it formatted.

Return type:

string

reports.info_dict(H, node=None, edge=None)[source]

Create a summary of simple statistics for H

Parameters:
  • H (Hypergraph) –

  • obj (optional) – either a node or edge uid from the hypergraph

Returns:

info_dict – Returns a dictionary of statistics of the size, aspect ratio, and density of the hypergraph.

Return type:

dict

reports.s_comp_dist(H, s=1, aggregated=False, edges=True, return_singletons=True)[source]

Computes s-component sizes, counting nodes or edges.

Parameters:
  • H (Hypergraph) –

  • s (positive integer, default is 1) –

  • aggregated – If aggregated is True, returns a dictionary of s-component sizes and counts in H. If aggregated is False, returns a list of s-component sizes in H.

  • edges – If edges is True, the component size is number of edges. If edges is False, the component size is number of nodes.

  • return_singletons (bool, optional, default=True) –

Returns:

s_comp_dist – List of component sizes or dictionary of component size distribution in H

Return type:

list or dictionary

See also

comp_dist

reports.s_edge_diameter_dist(H)[source]
Parameters:

H (Hypergraph) –

Returns:

s_edge_diameter_dist – List of s-edge-diameters for hypergraph H starting with s=1 and going up as long as the hypergraph is s-edge-connected

Return type:

list

reports.s_node_diameter_dist(H)[source]
Parameters:

H (Hypergraph) –

Returns:

s_node_diameter_dist – List of s-node-diameters for hypergraph H starting with s=1 and going up as long as the hypergraph is s-node-connected

Return type:

list

reports.toplex_dist(H, aggregated=False)[source]

Computes toplex sizes for hypergraph H.

Parameters:
  • H (Hypergraph) –

  • aggregated – If aggregated is True, returns a dictionary of toplex sizes and counts in H. If aggregated is False, returns a list of toplex sizes in H.

Returns:

toplex_dist – List of toplex sizes or dictionary of toplex size distribution in H

Return type:

list or dictionary