From ddda8d6213a03384d3e6c48478830bf1890d16d3 Mon Sep 17 00:00:00 2001
From: "Pavel N. Krivitsky"
Date: Mon, 18 Nov 2024 13:02:26 +1100
Subject: [PATCH] Made permute.vertexIDs() generic.
---
NAMESPACE | 1 +
R/access.R | 7 ++++++-
man/permute.vertexIDs.Rd | 7 ++++++-
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/NAMESPACE b/NAMESPACE
index 360b1da..5c1efcb 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -53,6 +53,7 @@ S3method(network.dyadcount,network)
S3method(network.edgecount,network)
S3method(network.naedgecount,network)
S3method(network.size,network)
+S3method(permute.vertexIDs,network)
S3method(plot,network)
S3method(plot.network,default)
S3method(print,mixingmatrix)
diff --git a/R/access.R b/R/access.R
index 9f30b38..9614225 100644
--- a/R/access.R
+++ b/R/access.R
@@ -1795,6 +1795,7 @@ network.vertex.names<-function(x){
#' @param x an object of class \code{\link{network}}.
#' @param vids a vector of vertex IDs, in the order to which they are to be
#' permuted.
+#' @param ... additional arguments to methods.
#' @return Invisibly, a pointer to the permuted network.
#' \code{permute.vertexIDs} modifies its argument in place.
#' @author Carter T. Butts \email{buttsc@@uci.edu}
@@ -1812,7 +1813,11 @@ network.vertex.names<-function(x){
#' all(flo[n:1,n:1]==as.sociomatrix(nflo)) #Should be TRUE
#'
#' @export permute.vertexIDs
-permute.vertexIDs<-function(x,vids){
+permute.vertexIDs <- function(x, vids, ...) UseMethod("permute.vertexIDs")
+
+#' @rdname permute.vertexIDs
+#' @export
+permute.vertexIDs.network <- function(x, vids, ...) {
#First, check to see that this is a graph object
if(!is.network(x))
stop("permute.vertexIDs requires an argument of class network.\n")
diff --git a/man/permute.vertexIDs.Rd b/man/permute.vertexIDs.Rd
index 4dc4a3a..f44c5f0 100644
--- a/man/permute.vertexIDs.Rd
+++ b/man/permute.vertexIDs.Rd
@@ -2,15 +2,20 @@
% Please edit documentation in R/access.R
\name{permute.vertexIDs}
\alias{permute.vertexIDs}
+\alias{permute.vertexIDs.network}
\title{Permute (Relabel) the Vertices Within a Network}
\usage{
-permute.vertexIDs(x, vids)
+permute.vertexIDs(x, vids, ...)
+
+\method{permute.vertexIDs}{network}(x, vids, ...)
}
\arguments{
\item{x}{an object of class \code{\link{network}}.}
\item{vids}{a vector of vertex IDs, in the order to which they are to be
permuted.}
+
+\item{...}{additional arguments to methods.}
}
\value{
Invisibly, a pointer to the permuted network.