Compose
¶
Bases: BaseTransform
Chains several transforms together.
The transforms are applied one after the other, each on the output of the
previous one. If a transform returns several graphs (e.g.
RandomLinkSplit), the following transforms
are applied to each of them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
transforms
|
Sequence[Callable[[Any], Any]]
|
The transforms (or any callables taking and returning a graph) to apply, in order. |
required |
Example:
from mlx_graphs.transforms.compose import Compose
from mlx_graphs.transforms.features import GCNNorm
from mlx_graphs.transforms.structure import RemoveSelfLoops, ToUndirected
transform = Compose([RemoveSelfLoops(), ToUndirected(), GCNNorm()])
graph = transform(graph)
Methods:
| Name | Description |
|---|---|
process |
Applies every transform in order. |
Source code in mlx_graphs/transforms/compose.py
process
¶
Applies every transform in order.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
A graph, or a list or tuple of graphs. |
required |
Returns:
| Type | Description |
|---|---|
Any
|
The output of the last transform. |
Source code in mlx_graphs/transforms/compose.py
from mlx_graphs.transforms import Compose · mlx_graphs/transforms/compose.py