Skip to contents

In case of a kNN graph with a subset of nodes having labels, this function can be used to propagate the labels through the graph. This function uses the label spreading version of the algorithm.

Usage

knn_graph_label_propagation(
  from,
  to,
  labels,
  weights = NULL,
  label_prop_params = params_label_propagation()
)

Arguments

from

Integer vector. Source node indices for each edge.

to

Integer vector. Target node indices for each edge. Must be the same length as from.

labels

Character vector. The labels with NA indicating unlabelled.

weights

Optional numeric vector. The weights between the nodes. Must be the same length as from. If not provided, all edges are treated as unweighted.

label_prop_params

List. Named list of label propagation parameters as generated by params_label_propagation(). If not provided, defaults will be used.

Value

A list with the following elements:

  • assignment_probs - Matrix with the assignment probabilities.

  • final_labels - Final labels in the graph.