% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/network_utils.R
\name{removeNetworkNodes}
\alias{removeNetworkNodes}
\title{Remove Specified Nodes from a Network Matrix}
\usage{
removeNetworkNodes(nodes_to_remove, network_table)
}
\arguments{
\item{nodes_to_remove}{Character vector of node IDs to remove from the network
(e.g. KEGG compound IDs, KO IDs). For compounds, both \code{"Cxxxxx"}
and \code{"cpd:Cxxxxx"} formats are accepted; internally they are
normalised to \code{"cpd:Cxxxxx"}.}

\item{network_table}{A matrix (typically 2 or 3 columns) representing the
network edge list, as generated by \code{buildKeggNetwork()} or related functions.}
}
\value{
A matrix of the same format as \code{network_table}, with all edges
involving the specified nodes removed and duplicate edges dropped.
}
\description{
Removes one or more nodes (compounds, KOs, reactions, etc.) from a network
edge list. All edges involving any of the specified nodes are removed.
}
\details{
All occurrences of the supplied node IDs are set to \code{NA}, and all
rows containing \code{NA} are then removed. This is useful to prune
unwanted nodes before downstream analyses such as distance or shortest-path
calculations.
}
\examples{
## Example — Remove a selected node from a human integrated network

## 1) Load the precomputed example network; see buildKeggNetwork() for its construction
data(MetaPathNet_example_network)
net_hsa <- MetaPathNet_example_network

## 2) Define node to remove
nodes_to_remove <- "cpd:C01213"   # (R)-Methylmalonyl-CoA

## 3) Remove all edges involving the selected node
net_hsa_filtered <- removeNetworkNodes(
  nodes_to_remove = nodes_to_remove,
  network_table   = net_hsa
)

## 4) Check that the node is no longer present
findMappedNodes(
  nodes         = nodes_to_remove,
  network_table = net_hsa_filtered
)$mapped_nodes

## 5) Compare network size before and after node removal
dim(net_hsa)           # Original network dimensions
dim(net_hsa_filtered)  # Network dimensions after node removal
nrow(net_hsa) - nrow(net_hsa_filtered)  # Number of removed edges

}
