@@ -21,10 +21,11 @@ def mapper_labels(X, y, cover, clustering):
2121 :type cover: A class from `tdamapper.cover`.
2222 :param clustering: A clustering algorithm.
2323 :type clustering: A class from `tdamapper.clustering` or a class from `sklearn.cluster`.
24- :return: A list where each item is a sorted list of ints with no duplicate.
25- The list at position `i` contains the cluster labels to which the point at position `i` in `X`
26- belongs to. If `i < j`, the labels at position `i` are strictly less then those at position `j`.
27- :rtype: `list[list[int]]`.
24+ :return: A list where each item is a sorted list of ints with no duplicate. The list at
25+ position `i` contains the cluster labels to which the point at position `i` in `X`
26+ belongs to. If `i < j`, the labels at position `i` are strictly less then those at
27+ position `j`.
28+ :rtype: `list[list[int]]`
2829 '''
2930 itm_lbls = [[] for _ in X ]
3031 max_lbl = 0
@@ -43,9 +44,10 @@ def mapper_labels(X, y, cover, clustering):
4344def mapper_connected_components (X , y , cover , clustering ):
4445 '''
4546 Computes the connected components of the Mapper graph.
46- The algorithm computes the connected components using a union-find data structure.
47- This approach should be faster than computing the Mapper graph by first calling
48- `tdamapper.core.mapper_graph` and then calling `networkx.connected_components` on it.
47+
48+ The algorithm computes the connected components using a union-find data structure. This
49+ approach should be faster than computing the Mapper graph by first calling `mapper_graph`
50+ and then calling `networkx.connected_components` on it.
4951
5052 :param X: A dataset.
5153 :type X: `numpy.ndarray` or list-like.
@@ -55,9 +57,9 @@ def mapper_connected_components(X, y, cover, clustering):
5557 :type cover: A class from `tdamapper.cover`.
5658 :param clustering: A clustering algorithm.
5759 :type clustering: A class from `tdamapper.clustering` or a class from `sklearn.cluster`.
58- :return: A list of labels, where the value at position `i` identifies
59- the connected component of the point `X[i]`.
60- :rtype: `list[int]`.
60+ :return: A list of labels, where the value at position `i` identifies the connected
61+ component of the point `X[i]`.
62+ :rtype: `list[int]`
6163 '''
6264 itm_lbls = mapper_labels (X , y , cover , clustering )
6365 label_values = set ()
@@ -91,7 +93,7 @@ def mapper_graph(X, y, cover, clustering):
9193 :param clustering: A clustering algorithm.
9294 :type clustering: A class from `tdamapper.clustering` or a class from `sklearn.cluster`.
9395 :return: The Mapper graph.
94- :rtype: `networkx.Graph`.
96+ :rtype: `networkx.Graph`
9597 '''
9698 itm_lbls = mapper_labels (X , y , cover , clustering )
9799 graph = nx .Graph ()
@@ -124,7 +126,7 @@ def aggregate_graph(y, graph, agg):
124126 :param agg: An aggregation function.
125127 :type agg: Callable.
126128 :return: A dict of values, where each node is mapped to its aggregation.
127- :rtype: `dict`.
129+ :rtype: `dict`
128130 '''
129131 agg_values = {}
130132 nodes = graph .nodes ()
@@ -142,7 +144,8 @@ class MapperAlgorithm:
142144 :param cover: A cover algorithm.
143145 :type cover: A class from `tdamapper.cover`.
144146 :param clustering: A clustering algorithm.
145- :type clustering: A class from `tdamapper.clustering` or a class from `sklearn.cluster`.
147+ :type clustering: A class from `tdamapper.clustering`
148+ or a class from `sklearn.cluster`
146149 '''
147150
148151 def __init__ (self , cover , clustering ):
@@ -152,7 +155,7 @@ def __init__(self, cover, clustering):
152155
153156 def fit (self , X , y = None ):
154157 '''
155- Computes the Mapper Graph
158+ Computes the Mapper Graph.
156159
157160 :param X: A dataset.
158161 :type X: `numpy.ndarray` or list-like.
0 commit comments