@graphty/algorithms / index / indexed / labelPropagationSemiSupervised
Function: labelPropagationSemiSupervised() ​
labelPropagationSemiSupervised(
s,seeds,options?):LabelPropagationResult
Defined in: indexed/label-propagation.ts:450
Semi-supervised label propagation: the FLPA kernel of labelPropagation with some nodes held at a given label (the initial / fixed inputs of igraph's community_label_propagation).
A seeded node keeps its label for the whole run and is never visited. Every other node starts UNLABELED, as a negative initial value means in igraph: it casts no vote, and on a visit it takes the label with the largest summed vote among its labeled neighbours, drawing uniformly among tied labels (its current one included), or stays unlabeled while it has none. So seed labels spread outward from the seeds, and every node joined to a seed by a path of voting arcs (any arc but a self-loop, with a positive weight when weighted) ends with some seed's label once the run converges. Seeds that share a label share one community from the start, and seeds with different labels are never merged, so in the result two seeds carry the same label exactly when their seed labels are equal.
Nodes no seed label reached -- a component with no seed, or a node cut off by the work cap -- end as igraph labels them: each connected group of them (joined by voting arcs) becomes a community of its own, so every node gets a label and the result is an ordinary partition. To tell those groups from the spread labels, compare labels[u] with the labels of the seed nodes. With no seed at all the result is one community per connected component.
The result is renumbered to 0..count-1 in first-seen node order like every other partition here, so a seed label's VALUE is not kept: read a seed's community through labels[seedNode].
converged is true when the work queue emptied, or when maxIterations is 0 and the starting labels already are dominant: no unseeded node has a labeled neighbour whose label outvotes its own (an unlabeled node next to a labeled one is not settled). Seeded nodes are not held to that.
Parameters ​
s ​
GraphSnapshot
Any snapshot
seeds ​
U32
One entry per node: its fixed label, any value but INVALID_INDEX, or INVALID_INDEX for a node free to move
options? ​
Work cap, seed of the visit order and weighting
Returns ​
The partition, the full-sweep equivalents run, and whether the work queue emptied
Throws ​
RangeError when seeds is not one entry per node, or for a bad option or weight