From 62cebb1ca5bc518d86fea9a89f6641060e674e88 Mon Sep 17 00:00:00 2001 From: "Pavel N. Krivitsky" Date: Tue, 2 Apr 2024 09:44:17 +1100 Subject: [PATCH] Made get.inducedSubgraph() generic. references statnet/network#86 --- DESCRIPTION | 2 +- NAMESPACE | 1 + R/access.R | 8 +++++++- man/get.inducedSubgraph.Rd | 5 ++++- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index deefe26..98308dd 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -23,7 +23,7 @@ Suggests: Description: Tools to create and modify network objects. The network class can represent a range of relational data types, and supports arbitrary vertex/edge/graph attributes. License: GPL (>=2) URL: https://statnet.org/ -RoxygenNote: 7.2.0 +RoxygenNote: 7.3.1 Roxygen: list(markdown = TRUE) Collate: 'access.R' diff --git a/NAMESPACE b/NAMESPACE index 713e4f5..360b1da 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -37,6 +37,7 @@ S3method(get.edge.attribute,list) S3method(get.edge.attribute,network) S3method(get.edge.value,list) S3method(get.edge.value,network) +S3method(get.inducedSubgraph,network) S3method(get.network.attribute,network) S3method(get.vertex.attribute,network) S3method(is.bipartite,mixingmatrix) diff --git a/R/access.R b/R/access.R index 8b94474..e275e0e 100644 --- a/R/access.R +++ b/R/access.R @@ -936,7 +936,13 @@ get.dyads.eids<-function(x,tails,heads,neighborhood = c("out", "in", "combined") #' #' #' @export get.inducedSubgraph -get.inducedSubgraph<-function(x, v, alters=NULL, eid=NULL){ +get.inducedSubgraph <- function(x, ...) { + UseMethod("get.inducedSubgraph") +} + +#' @rdname get.inducedSubgraph +#' @export +get.inducedSubgraph.network <- function(x, v, alters=NULL, eid=NULL){ #Check to be sure we were called with a network if(!is.network(x)) stop("get.inducedSubgraph requires an argument of class network.") diff --git a/man/get.inducedSubgraph.Rd b/man/get.inducedSubgraph.Rd index f4fdb25..b8a5fd1 100644 --- a/man/get.inducedSubgraph.Rd +++ b/man/get.inducedSubgraph.Rd @@ -2,10 +2,13 @@ % Please edit documentation in R/access.R, R/operators.R \name{get.inducedSubgraph} \alias{get.inducedSubgraph} +\alias{get.inducedSubgraph.network} \alias{\%s\%} \title{Retrieve Induced Subgraphs and Cuts} \usage{ -get.inducedSubgraph(x, v, alters = NULL, eid = NULL) +get.inducedSubgraph(x, ...) + +\method{get.inducedSubgraph}{network}(x, v, alters = NULL, eid = NULL) x \%s\% v }