Skip to content

Commit

Permalink
version 1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
albertoarcagni authored and cran-robot committed Sep 7, 2023
1 parent ded6071 commit aa73c49
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 13 deletions.
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: HOasso
Type: Package
Title: Higher Order Assortativity for Complex Networks
Version: 1.0.0
Date: 2023-07-21
Version: 1.0.1
Date: 2023-09-07
Authors@R: c(person("Alberto", "Arcagni", role = c("aut", "cre"), email = "alberto.arcagni@uniroma1.it"), person("Roy", "Cerqueti", role = c("aut")), person("Rosanna", "Grassi", role = c("aut")))
Author: Alberto Arcagni [aut, cre],
Roy Cerqueti [aut],
Expand All @@ -13,7 +13,7 @@ RdMacros: Rdpack
License: GPL (>= 2)
Encoding: UTF-8
NeedsCompilation: no
Packaged: 2023-08-10 10:04:48 UTC; Alberto
Packaged: 2023-09-07 08:23:50 UTC; alber
Maintainer: Alberto Arcagni <alberto.arcagni@uniroma1.it>
Repository: CRAN
Date/Publication: 2023-08-11 08:10:02 UTC
Date/Publication: 2023-09-07 08:40:10 UTC
12 changes: 7 additions & 5 deletions MD5
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
53cef403a3435cf508be10b7bf061a4f *DESCRIPTION
740a27e00bcbc56143f5897b0f897cf2 *NAMESPACE
cb5dde28544d0c2c5b72b3589eb9fb28 *R/HOasso.R
d24568214203b863f387622b7c2db5f7 *build/partial.rdb
7d5e7c35a9744b8dc2167418fa443f59 *DESCRIPTION
fc420ee82fc67c21481a1d5e84d9346b *NAMESPACE
dfaafb7176f3ba787f1e11c28ac807e4 *R/HOasso.R
2db4ede97bb98e8a886821db996b0e8c *R/plot.assortativity.R
379de7059a1e55b33f3fc2e51ac8f070 *R/print.assortativity.R
0940d37adb75b7d4e453e90fb64f3258 *build/partial.rdb
88faf3510a569a1df58dd341d105b5c1 *inst/REFERENCES.bib
9a60794edffbdbc41b2de921d45c8479 *man/HOasso.Rd
b30d056cca79f67167e87c9ae402914f *man/HOasso.Rd
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
exportPattern("^[[:alpha:]]+")
import("igraph")
import("Rdpack")
importFrom("graphics", "plot.default")
S3method(plot, assortativity)
S3method(print, assortativity)
2 changes: 2 additions & 0 deletions R/HOasso.R
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,7 @@ HOasso <- function(
warning(paste0("Error of approximation to zero of the covariance or a variance, ", sum(sel), "results forced to NaN"))
}

class(res) <- c("assortativity", "numeric")

return(res)
}
22 changes: 22 additions & 0 deletions R/plot.assortativity.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
plot.assortativity <- function(x,
type = "h",
ylim = c(-1, 1),
xlab = "Orders",
ylab = "Assortativity",
...
) {

h <- length(x)

plot.default(
x = 1:h,
y = as.numeric(x),
type = type,
ylim = ylim,
xlab = xlab,
ylab = ylab,
...
)

invisible(NULL)
}
7 changes: 7 additions & 0 deletions R/print.assortativity.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
print.assortativity <- function(x, ...) {
h <- length(x)
x <- matrix(x, dimnames = list(order = 1:h, "assortativity"))
print(x)

invisible(NULL)
}
Binary file modified build/partial.rdb
Binary file not shown.
31 changes: 27 additions & 4 deletions man/HOasso.Rd
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
\name{HOasso}
\alias{HOasso}
\alias{plot.assortativity}
\alias{print.assortativity}
\title{Evalutes Higer Order Assortativity of complex networks}
\usage{
HOasso(
Expand All @@ -9,13 +11,29 @@ HOasso(
x = c("sout", "dout", "lout", "sin", "din", "lin"),
y = c("sin", "din", "lin", "sout", "dout", "lout")
)

\method{plot}{assortativity}(x,
type = "h",
ylim = c(-1, 1),
xlab = "Orders",
ylab = "Assortativity",
...
)

\method{print}{assortativity}(x, ...)
}

\arguments{
\item{g}{an object of class \code{igraph} with two columns, listing the dominances, by rows.}
\item{h}{an integer value, the function will evaluates the assortativity from the order 1 to the order \code{h}.}
\item{weighted}{\code{logical}, if to use the weighted matrix to create the trasnition probabilities.}
\item{x}{The first centrarlity measure, out-strength by default, see \code{details}.}
\item{x}{In case of the \code{HOasso} function the first centrarlity measure, out-strength by default, see \code{details}. An object of class \code{assortativity} in case of the \code{print} and \code{plot} functions}
\item{y}{The second centrarlity measure, in-strength by default, see \code{details}.}
\item{type}{Type of plot, histogram-like vertical lines by default.}
\item{xlab}{A label for the x axis, \code{Orders} by default.}
\item{ylab}{A label for the x axis, \code{Assortativity} by default.}
\item{ylim}{The y limits of the plot, the assortativity index can assume only values between -1 and 1.}
\item{...}{Other arguments of the \code{plot.default} or the \code{print.default} functions.}
}
\value{A vector \code{h} long containing the assortativity measures from the order 1 to the order \code{h}.}
\description{
Expand All @@ -25,6 +43,12 @@ The function evalutes Higer Order Assortativity of complex networks represented
Arguments \code{x} and {y} are \code{character} objects and can assume values \code{"sout"}, \code{"dout"}, \code{"lout"}, \code{"sin"}, \code{"din"}, \code{"lin"} representing the out-strength, out-degree, out-log-strength, in-strength, in-degree, and in-log-strength respectively.

In case of undirected graphs in- and out- centrality measures are equal. In case of unweighted graphs the strength is equal to the degree.

The function returns an object of class \code{assortativity} subclass of a \code{numeric} vector.

\code{plot.assortativity} is identical to \code{plot.default} but with different defaults in order to get a plot coherent with the assortativity index.

\code{print.assortativity} is a method to show the assortativity values and the order side by syde.
}
\references{
\insertRef{arcagni2017higher}{HOasso}
Expand All @@ -40,8 +64,7 @@ In case of undirected graphs in- and out- centrality measures are equal. In case
weight = c( 10, 5, 2, 3, 2 )
))
E(g)$label <- E(g)$weight
plot(g, layout = layout_in_circle(g))
a <- HOasso(g, h = 10)
a
plot(a, type = "b", ylim = c(-1, 1), panel.first = abline(h = 0, lty = 2))
print(a)
plot(a, lwd = 3, panel.first = abline(h = 0, lty = 2))
}

0 comments on commit aa73c49

Please sign in to comment.