% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/LabelPropagation.R
\name{LabelPropagation}
\alias{LabelPropagation}
\title{Label Propagation via PageRank}
\usage{
LabelPropagation(A, seeds, damping = 0.85, max_iter = 1000L, tol = 1e-08)
}
\arguments{
\item{A}{Square non-negative adjacency/weight matrix (n x n)}

\item{seeds}{Named integer vector or factor. Names correspond to node indices
(1-based), values are the class labels. Unlabeled nodes will be classified.}

\item{damping}{Damping factor passed to \code{\link{PageRank}} (default: 0.85)}

\item{max_iter}{Maximum iterations for PageRank (default: 1000)}

\item{tol}{Convergence tolerance for PageRank (default: 1e-8)}
}
\value{
A list with components:
  \describe{
    \item{labels}{Integer vector of predicted labels for all nodes}
    \item{scores}{Matrix (n x K) of PageRank-based scores per class}
    \item{classes}{Unique class labels}
  }
}
\description{
Semi-supervised label propagation on a graph. Uses Personalized PageRank
internally to propagate labels from seed nodes to the rest of the graph.
}
\examples{
# 6-node graph with 2 communities
A <- matrix(0, 6, 6)
A[1,2] <- A[2,1] <- 1; A[1,3] <- A[3,1] <- 1; A[2,3] <- A[3,2] <- 1
A[4,5] <- A[5,4] <- 1; A[4,6] <- A[6,4] <- 1; A[5,6] <- A[6,5] <- 1
A[3,4] <- A[4,3] <- 0.5  # weak bridge
seeds <- c("1" = 1, "6" = 2)  # node 1 -> class 1, node 6 -> class 2
result <- LabelPropagation(A, seeds)
result$labels
}
