% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/subtract_networks.R
\name{subtract_networks}
\alias{subtract_networks}
\alias{print.netdifference}
\title{Subtract one network from another}
\usage{
subtract_networks(x, y)

\method{print}{netdifference}(x, max_print = 12L, ...)
}
\arguments{
\item{x, y}{A \code{netobject}, \code{cograph_network}, or numeric square
matrix. Both must share the same nodes in the same order.}

\item{max_print}{Integer. Rows to show in \code{print()}. Default \code{12}.}

\item{...}{Ignored.}
}
\value{
A \code{netdifference} object: a \code{netobject} whose
\code{$weights} and \code{$difference_matrix} are \code{x - y}, carrying
the source matrices \code{$x} and \code{$y}.
}
\description{
Returns \code{x - y} as a \code{netdifference} object: the element-wise
difference of the two weight matrices. Works on any pair of networks; for an
edge-betweenness difference, subtract two \code{\link{net_edge_betweenness}}
results. Draw the signed difference network with \code{cograph::splot(d)}
or \code{cograph::plot_difference(d)}; cograph handles the colouring and
node palette.
}
\examples{
seqs <- data.frame(
  V1 = c("A","B","A","C","B","A"), V2 = c("B","C","B","A","C","B"),
  V3 = c("C","A","C","B","A","C"))
a <- build_network(seqs, method = "relative")
b <- build_network(seqs[1:4, ], method = "relative")
subtract_networks(a, b)
# edge-betweenness difference:
subtract_networks(net_edge_betweenness(a), net_edge_betweenness(b))
}
