1.4. MapperGraph class
This is the mapper graph class which is inherited from the Reeb graph class. The main differences are
The Mapper graph is a graph with a function, but all function values are stored as integers. There is also a stored
delta
value which is can be used for scaling, so that all function values can be thought of asdelta * f(v)
.All edges have adjacent integer values. This equivalently means that no integer has a point in the interior of an edge in its inverse image.
Note that this class can be imported as:
import cereeberus
R = cereeberus.MapperGraph()
- class cereeberus.reeb.mapper.MapperGraph(G=None, f={}, delta=None, seed=None, verbose=False)[source]
A mapper graph structure. This inherits the properties of the Reeb graph in that it is a graph with a function given on the vertices, but with some additional requirements.
The values are integers in some range, [n_low, n_low+1, cdots, n_high], although we consider the funciton values to be [delta * n_low, delta* (n_low+1), cdots, delta * n_high] for a stored delta
If an edge crosses a value, it has a vertex (so that the inverse image of any integer is only vertices, not interiors of edges)
An internal delta is stored so that this can be interpreted as function values [delta * n_low, delta* (n_low+1), cdots, delta * n_high]
- __init__(G=None, f={}, delta=None, seed=None, verbose=False)[source]
Initializes a Reeb graph object.
- Parameters:
G – nx.graph, optional. If not None, a graph to initialize the Reeb graph.
f – dict, optional. If not an empty dictionary, a dictionary of function values associated with the graph nodes.
seed – int, optional. If not None, a seed to pass to the spring layout.
verbose – bool, optional. If True, will print out additional information during initialization.
- add_edge(u, v, reset_pos=True)[source]
Add an edge to the graph. This will also update the internal structure to make sure it satisfies the mapper properties.
- mapperify()[source]
Take the internal structure and make sure it satisfies the requirement that all edges have adjacent function values.
- add_node(vertex, f_vertex, reset_pos=True)[source]
Same as adding a node in Reeb, but with the additional requirement that the function value is an integer.
- set_pos_from_f(seed=None, verbose=False)[source]
Same as the Reeb graph function, but we want to draw the vertex locations at delta*function value.
- induced_subgraph(nodes)[source]
Returns the subgraph of the mapper graph induced by the nodes in the list nodes.
- Parameters:
nodes (list) – The list of nodes to include in the subgraph.
- Returns:
MapperGraph
- smoothing_and_maps(n=1)[source]
Compute the smoothing of a mapper graph as given in todo: Cite the paper. Note that the input \(n\) parameter is related to the integer function values, not the delta-scaled function values.
- Parameters:
n (int) – The amount of smoothing
- Returns:
MapperGraph, vertex_map, edge_map
- Return type:
tuple
- smoothing(n=1)[source]
Compute the smoothing of a mapper graph as given in todo: Cite the paper. Note that the input \(n\) parameter is related to the integer function values, not the delta-scaled function values.
- Parameters:
n (int, optional) – Smoothing amount. Defaults to 1.
- Raises:
ValueError – _description_
- Returns:
_description_
- Return type:
_type_
- thickening_distance_by_level(level, obj_type='V')[source]
Get the thickening distance matrix at a given level. This distance is the amount of thickening needed before the given pair of vertices at that level map to the same connected component.
- Parameters:
level – int. The level to get the thickening distance matrix at.
obj_type – str. ‘V’ or ‘E’ to get the distance matrix for vertices or edges, respectively. Default is ‘V’.
- Returns:
LabeledMatrix