% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/centrality.R
\name{edge_centrality}
\alias{edge_centrality}
\alias{edge_betweenness}
\title{Calculate Edge Centrality Measures}
\usage{
edge_centrality(
  x,
  measures = "all",
  weighted = TRUE,
  directed = NULL,
  cutoff = -1,
  invert_weights = NULL,
  alpha = 1,
  digits = NULL,
  sort_by = NULL,
  ...
)

edge_betweenness(x, ...)
}
\arguments{
\item{x}{Network input (matrix, igraph, network, cograph_network, tna object)}

\item{measures}{Which measures to calculate. Default "all" calculates all
available edge measures. Options: "betweenness", "weight".}

\item{weighted}{Logical. Use edge weights if available. Default TRUE.}

\item{directed}{Logical or NULL. If NULL (default), auto-detect from matrix
symmetry. Set TRUE to force directed, FALSE to force undirected.}

\item{cutoff}{Maximum path length for betweenness. Default -1 (no limit).}

\item{invert_weights}{Logical or NULL. Invert weights for path-based measures?
Default NULL (auto-detect: TRUE for tna objects, FALSE otherwise).}

\item{alpha}{Numeric. Exponent for weight inversion. Default 1.}

\item{digits}{Integer or NULL. Round numeric columns. Default NULL.}

\item{sort_by}{Character or NULL. Column to sort by (descending). Default NULL.}

\item{...}{Additional arguments passed to \code{\link{to_igraph}}}
}
\value{
A data frame with columns:
\itemize{
\item \code{from}: Source node label
\item \code{to}: Target node label
\item \code{weight}: Edge weight (if weighted)
\item \code{betweenness}: Edge betweenness centrality
}

Named numeric vector of edge betweenness values (named by
\code{"from->to"}).
}
\description{
Computes centrality measures for edges in a network and returns a tidy
data frame. Unlike node centrality, these measures describe edge importance.
}
\details{
Edge centrality measures available:
\describe{
\item{betweenness}{Number of shortest paths passing through the edge.
Edges with high betweenness are bridges connecting different parts
of the network.}
\item{weight}{Original edge weight (included for reference)}
}
}
\examples{
# Create test network
mat <- matrix(c(0,1,1,0, 1,0,1,1, 1,1,0,0, 0,1,0,0), 4, 4)
rownames(mat) <- colnames(mat) <- c("A", "B", "C", "D")

# All edge measures
edge_centrality(mat)

# Just betweenness
edge_centrality(mat, measures = "betweenness")

# Sort by betweenness to find bridge edges
edge_centrality(mat, sort_by = "betweenness")
mat <- matrix(c(0,1,1,0, 1,0,1,1, 1,1,0,0, 0,1,0,0), 4, 4)
rownames(mat) <- colnames(mat) <- c("A", "B", "C", "D")
edge_betweenness(mat)
}
