
Compute closest distance between two gene sets in a network
set_distance.RdFor each node in set B, finds the shortest-path distance to the nearest node in set A (and vice versa), then returns the mean across all nodes. Only nodes present in the graph are considered.
Value
A single numeric value — the mean closest distance between the
two sets. Returns NaN if no valid paths exist.
Examples
if (FALSE) { # \dontrun{
g <- build_ppi_network(ppi_df, all_genes)
set_distance(g, c("TP53", "BRCA1"), c("EGFR", "VEGFA", "TNF"))
} # }