Skip to content

Distance

Distance(
    norm: bool = True,
    max_value: Optional[float] = None,
    cat: bool = True,
    interval: Tuple[float, float] = (0.0, 1.0),
)

Bases: BaseTransform

Saves the Euclidean distance of linked nodes in its edge features.

Parameters:

Name Type Description Default
norm bool

If True, normalizes the distances to interval. Default: True

True
max_value Optional[float]

If set and norm is True, normalizes with this value instead of the largest distance. Default: None

None
cat bool

If False, replaces the existing edge features instead of concatenating. Default: True

True
interval Tuple[float, float]

The interval of the normalized distances. Default: (0.0, 1.0)

(0.0, 1.0)

Example:

from mlx_graphs.transforms import Distance

graph = Distance(norm=False)(graph)
Source code in mlx_graphs/transforms/point_cloud.py
def __init__(
    self,
    norm: bool = True,
    max_value: Optional[float] = None,
    cat: bool = True,
    interval: Tuple[float, float] = (0.0, 1.0),
):
    self.norm = norm
    self.max = max_value
    self.cat = cat
    self.interval = interval

from mlx_graphs.transforms import Distance · mlx_graphs/transforms/point_cloud.py