Commit ac92aba9 authored by Andreas Tille's avatar Andreas Tille

New upstream version 1.2.1

parent 87a296fa
Package: igraph Package: igraph
Version: 1.1.2 Version: 1.2.1
Title: Network Analysis and Visualization Title: Network Analysis and Visualization
Author: See AUTHORS file. Author: See AUTHORS file.
Maintainer: Gábor Csárdi <csardi.gabor@gmail.com> Maintainer: Gábor Csárdi <csardi.gabor@gmail.com>
...@@ -7,13 +7,12 @@ Description: Routines for simple graphs and network analysis. It can ...@@ -7,13 +7,12 @@ Description: Routines for simple graphs and network analysis. It can
handle large graphs very well and provides functions for generating random handle large graphs very well and provides functions for generating random
and regular graphs, graph visualization, centrality methods and much more. and regular graphs, graph visualization, centrality methods and much more.
Depends: methods Depends: methods
Imports: graphics, grDevices, irlba, magrittr, Matrix, pkgconfig (>= Imports: graphics, grDevices, magrittr, Matrix, pkgconfig (>= 2.0.0),
2.0.0), stats, utils stats, utils
Suggests: ape, graph, igraphdata, NMF, rgl, scales, stats4, tcltk, Suggests: ape, graph, igraphdata, rgl, scales, stats4, tcltk, testthat
testthat
License: GPL (>= 2) License: GPL (>= 2)
URL: http://igraph.org URL: http://igraph.org
SystemRequirements: gmp, libxml2 SystemRequirements: gmp (optional), libxml2 (optional), glpk (optional)
BugReports: https://github.com/igraph/igraph/issues BugReports: https://github.com/igraph/igraph/issues
Encoding: UTF-8 Encoding: UTF-8
Collate: 'adjacency.R' 'auto.R' 'assortativity.R' 'attributes.R' Collate: 'adjacency.R' 'auto.R' 'assortativity.R' 'attributes.R'
...@@ -24,15 +23,15 @@ Collate: 'adjacency.R' 'auto.R' 'assortativity.R' 'attributes.R' ...@@ -24,15 +23,15 @@ Collate: 'adjacency.R' 'auto.R' 'assortativity.R' 'attributes.R'
'fit.R' 'flow.R' 'foreign.R' 'games.R' 'glet.R' 'hrg.R' 'fit.R' 'flow.R' 'foreign.R' 'games.R' 'glet.R' 'hrg.R'
'igraph-package.R' 'incidence.R' 'indexing.R' 'interface.R' 'igraph-package.R' 'incidence.R' 'indexing.R' 'interface.R'
'iterators.R' 'layout.R' 'layout_drl.R' 'lazyeval.R' 'make.R' 'iterators.R' 'layout.R' 'layout_drl.R' 'lazyeval.R' 'make.R'
'mgclust.R' 'minimum.spanning.tree.R' 'motifs.R' 'nexus.R' 'minimum.spanning.tree.R' 'motifs.R' 'nexus.R' 'operators.R'
'operators.R' 'other.R' 'package.R' 'palette.R' 'par.R' 'other.R' 'package.R' 'palette.R' 'par.R' 'paths.R' 'plot.R'
'paths.R' 'plot.R' 'plot.common.R' 'plot.shapes.R' 'pp.R' 'plot.common.R' 'plot.shapes.R' 'pp.R' 'print.R' 'printr.R'
'print.R' 'printr.R' 'random_walk.R' 'rewire.R' 'scan.R' 'random_walk.R' 'rewire.R' 'scan.R' 'scg.R' 'sgm.R'
'scg.R' 'sgm.R' 'similarity.R' 'simple.R' 'sir.R' 'socnet.R' 'similarity.R' 'simple.R' 'sir.R' 'socnet.R' 'sparsedf.R'
'sparsedf.R' 'structural.properties.R' 'structure.info.R' 'structural.properties.R' 'structure.info.R' 'test.R'
'test.R' 'tkplot.R' 'topology.R' 'triangles.R' 'utils.R' 'tkplot.R' 'topology.R' 'triangles.R' 'utils.R' 'uuid.R'
'uuid.R' 'versions.R' 'weakref.R' 'zzz-deprecate.R' 'versions.R' 'weakref.R' 'zzz-deprecate.R'
NeedsCompilation: yes NeedsCompilation: yes
Packaged: 2017-07-20 21:33:52 UTC; gaborcsardi Packaged: 2018-03-10 12:30:48 UTC; gaborcsardi
Repository: CRAN Repository: CRAN
Date/Publication: 2017-07-21 11:39:40 UTC Date/Publication: 2018-03-10 21:33:20 UTC
This diff is collapsed.
...@@ -141,6 +141,7 @@ export(as_adjacency_matrix) ...@@ -141,6 +141,7 @@ export(as_adjacency_matrix)
export(as_bipartite) export(as_bipartite)
export(as_data_frame) export(as_data_frame)
export(as_edgelist) export(as_edgelist)
export(as_graphnel)
export(as_ids) export(as_ids)
export(as_incidence_matrix) export(as_incidence_matrix)
export(as_long_data_frame) export(as_long_data_frame)
...@@ -338,8 +339,6 @@ export(from_literal) ...@@ -338,8 +339,6 @@ export(from_literal)
export(full_bipartite_graph) export(full_bipartite_graph)
export(full_citation_graph) export(full_citation_graph)
export(full_graph) export(full_graph)
export(gclust.app)
export(gclust.rsvt)
export(get.adjacency) export(get.adjacency)
export(get.adjedgelist) export(get.adjedgelist)
export(get.adjlist) export(get.adjlist)
...@@ -356,7 +355,6 @@ export(get.incidence) ...@@ -356,7 +355,6 @@ export(get.incidence)
export(get.shortest.paths) export(get.shortest.paths)
export(get.stochastic) export(get.stochastic)
export(get.vertex.attribute) export(get.vertex.attribute)
export(getAICc)
export(getIgraphOpt) export(getIgraphOpt)
export(get_diameter) export(get_diameter)
export(girth) export(girth)
...@@ -433,6 +431,7 @@ export(graph_from_atlas) ...@@ -433,6 +431,7 @@ export(graph_from_atlas)
export(graph_from_data_frame) export(graph_from_data_frame)
export(graph_from_edgelist) export(graph_from_edgelist)
export(graph_from_graphdb) export(graph_from_graphdb)
export(graph_from_graphnel)
export(graph_from_incidence_matrix) export(graph_from_incidence_matrix)
export(graph_from_isomorphism_class) export(graph_from_isomorphism_class)
export(graph_from_lcf) export(graph_from_lcf)
......
...@@ -889,10 +889,8 @@ community.to.membership2 <- function(merges, vcount, steps) { ...@@ -889,10 +889,8 @@ community.to.membership2 <- function(merges, vcount, steps) {
#' see references.} \item{inner.links}{The number of edges within the community #' see references.} \item{inner.links}{The number of edges within the community
#' of \code{vertex}.} \item{outer.links}{The number of edges between the #' of \code{vertex}.} \item{outer.links}{The number of edges between the
#' community of \code{vertex} and the rest of the graph. } #' community of \code{vertex} and the rest of the graph. }
#' @author Jorg Reichardt #' @author Jorg Reichardt for the original code and Gabor Csardi
#' (\url{http://theorie.physik.uni-wuerzburg.de/~reichardt/}) for the original #' \email{csardi.gabor@@gmail.com} for the igraph glue code.
#' code and Gabor Csardi \email{csardi.gabor@@gmail.com} for the igraph glue
#' code.
#' #'
#' Changes to the original function for including the possibility of negative #' Changes to the original function for including the possibility of negative
#' ties were implemented by Vincent Traag (\url{http://www.traag.net/}). #' ties were implemented by Vincent Traag (\url{http://www.traag.net/}).
...@@ -1542,6 +1540,27 @@ cluster_louvain <- function(graph, weights=NULL) { ...@@ -1542,6 +1540,27 @@ cluster_louvain <- function(graph, weights=NULL) {
#' fifty vertices should be fine, graphs with a couple of hundred vertices #' fifty vertices should be fine, graphs with a couple of hundred vertices
#' might be possible. #' might be possible.
#' #'
#' @section Examples:
#' \preformatted{
#'
#' ## Zachary's karate club
#' g <- make_graph("Zachary")
#'
#' ## We put everything into a big 'try' block, in case
#' ## igraph was compiled without GLPK support
#'
#' ## The calculation only takes a couple of seconds
#' oc <- cluster_optimal(g)
#'
#' ## Double check the result
#' print(modularity(oc))
#' print(modularity(g, membership(oc)))
#'
#' ## Compare to the greedy optimizer
#' fc <- cluster_fast_greedy(g)
#' print(modularity(fc))
#' }
#'
#' @aliases optimal.community #' @aliases optimal.community
#' @param graph The input graph. Edge directions are ignored for directed #' @param graph The input graph. Edge directions are ignored for directed
#' graphs. #' graphs.
...@@ -1561,27 +1580,7 @@ cluster_louvain <- function(graph, weights=NULL) { ...@@ -1561,27 +1580,7 @@ cluster_louvain <- function(graph, weights=NULL) {
#' 2008. #' 2008.
#' @export #' @export
#' @keywords graphs #' @keywords graphs
#' @examples
#'
#' ## Zachary's karate club
#' g <- make_graph("Zachary")
#'
#' ## We put everything into a big 'try' block, in case
#' ## igraph was compiled without GLPK support
#'
#' try({
#' ## The calculation only takes a couple of seconds
#' oc <- cluster_optimal(g)
#'
#' ## Double check the result
#' print(modularity(oc))
#' print(modularity(g, membership(oc)))
#'
#' ## Compare to the greedy optimizer
#' fc <- cluster_fast_greedy(g)
#' print(modularity(fc))
#' }, silent=TRUE)
#'
cluster_optimal <- function(graph, weights=NULL) { cluster_optimal <- function(graph, weights=NULL) {
# Argument checks # Argument checks
if (!is_igraph(graph)) { stop("Not a graph object") } if (!is_igraph(graph)) { stop("Not a graph object") }
...@@ -1637,7 +1636,7 @@ cluster_optimal <- function(graph, weights=NULL) { ...@@ -1637,7 +1636,7 @@ cluster_optimal <- function(graph, weights=NULL) {
#' please see the \code{\link{communities}} manual page for details. #' please see the \code{\link{communities}} manual page for details.
#' @author Martin Rosvall (\url{http://www.tp.umu.se/~rosvall/}) wrote the #' @author Martin Rosvall (\url{http://www.tp.umu.se/~rosvall/}) wrote the
#' original C++ code. This was ported to be more igraph-like by Emmanuel #' original C++ code. This was ported to be more igraph-like by Emmanuel
#' Navarro (\url{http://enavarro.me/}). The R interface and #' Navarro. The R interface and
#' some cosmetics was done by Gabor Csardi \email{csardi.gabor@@gmail.com}. #' some cosmetics was done by Gabor Csardi \email{csardi.gabor@@gmail.com}.
#' @seealso Other community finding methods and \code{\link{communities}}. #' @seealso Other community finding methods and \code{\link{communities}}.
#' @references The original paper: M. Rosvall and C. T. Bergstrom, Maps of #' @references The original paper: M. Rosvall and C. T. Bergstrom, Maps of
......
...@@ -456,7 +456,7 @@ as_adj_edge_list <- function(graph, mode=c("all", "out", "in", "total")) { ...@@ -456,7 +456,7 @@ as_adj_edge_list <- function(graph, mode=c("all", "out", "in", "total")) {
#' g4 <- graph_from_graphnel(GNEL2) #' g4 <- graph_from_graphnel(GNEL2)
#' g4 #' g4
#' } #' }
#' #' @export #' @export
graph_from_graphnel <- function(graphNEL, name=TRUE, weight=TRUE, graph_from_graphnel <- function(graphNEL, name=TRUE, weight=TRUE,
unlist.attrs=TRUE) { unlist.attrs=TRUE) {
...@@ -543,7 +543,7 @@ graph_from_graphnel <- function(graphNEL, name=TRUE, weight=TRUE, ...@@ -543,7 +543,7 @@ graph_from_graphnel <- function(graphNEL, name=TRUE, weight=TRUE,
#' g4 <- graph_from_graphnel(GNEL2) #' g4 <- graph_from_graphnel(GNEL2)
#' g4 #' g4
#' } #' }
#' #' @export #' @export
as_graphnel <- function(graph) { as_graphnel <- function(graph) {
......
...@@ -480,14 +480,13 @@ write.graph.dot <- function(graph, file, ...) { ...@@ -480,14 +480,13 @@ write.graph.dot <- function(graph, file, ...) {
#' \emph{Pattern Recognition Letters}, Volume 24, Issue 8 (May 2003) #' \emph{Pattern Recognition Letters}, Volume 24, Issue 8 (May 2003)
#' @export #' @export
#' @keywords graphs #' @keywords graphs
#' @examples #' @section Examples:
#' #' \preformatted{
#' \dontrun{
#' g <- graph_from_graphdb(prefix="iso", type="r001", nodes=20, pair="A", #' g <- graph_from_graphdb(prefix="iso", type="r001", nodes=20, pair="A",
#' which=10, compressed=TRUE) #' which=10, compressed=TRUE)
#' g2 <- graph_from_graphdb(prefix="iso", type="r001", nodes=20, pair="B", #' g2 <- graph_from_graphdb(prefix="iso", type="r001", nodes=20, pair="B",
#' which=10, compressed=TRUE) #' which=10, compressed=TRUE)
#' graph.isomorphic.vf2(g, g2) % should be TRUE #' graph.isomorphic.vf2(g, g2) \% should be TRUE
#' g3 <- graph_from_graphdb(url=paste(sep="/", #' g3 <- graph_from_graphdb(url=paste(sep="/",
#' "http://cneurocvs.rmki.kfki.hu", #' "http://cneurocvs.rmki.kfki.hu",
#' "graphdb/gzip/iso/bvg/b06m", #' "graphdb/gzip/iso/bvg/b06m",
......
...@@ -1424,7 +1424,13 @@ dot_product <- function(...) constructor_spec(sample_dot_product, ...) ...@@ -1424,7 +1424,13 @@ dot_product <- function(...) constructor_spec(sample_dot_product, ...)
#' #'
#' Create a number of Erdos-Renyi random graphs with identical parameters, and #' Create a number of Erdos-Renyi random graphs with identical parameters, and
#' connect them with the specified number of edges. #' connect them with the specified number of edges.
#' #'
#' @section Examples:
#' \preformatted{
#' g <- sample_islands(3, 10, 5/10, 1)
#' oc <- cluster_optimal(g)
#' oc
#' }
#' #'
#' @aliases interconnected.islands.game sample_islands #' @aliases interconnected.islands.game sample_islands
#' @param islands.n The number of islands in the graph. #' @param islands.n The number of islands in the graph.
...@@ -1436,11 +1442,6 @@ dot_product <- function(...) constructor_spec(sample_dot_product, ...) ...@@ -1436,11 +1442,6 @@ dot_product <- function(...) constructor_spec(sample_dot_product, ...)
#' @author Samuel Thiriot #' @author Samuel Thiriot
#' @seealso \code{\link{sample_gnp}} #' @seealso \code{\link{sample_gnp}}
#' @keywords graphs #' @keywords graphs
#' @examples
#'
#' g <- sample_islands(3, 10, 5/10, 1)
#' oc <- cluster_optimal(g)
#' oc
#' @export #' @export
sample_islands <- sample_islands sample_islands <- sample_islands
......
...@@ -663,7 +663,7 @@ simple_es_index <- function(x, i) { ...@@ -663,7 +663,7 @@ simple_es_index <- function(x, i) {
#' \item Named graphs can be indexed with character vectors, #' \item Named graphs can be indexed with character vectors,
#' to select edges with the given names. Note that a graph may #' to select edges with the given names. Note that a graph may
#' have edge names and vertex names, and both can be used to select #' have edge names and vertex names, and both can be used to select
#' edges. Edge names are simply used as names of the nuumeric #' edges. Edge names are simply used as names of the numeric
#' edge id vector. Vertex names effectively only work in graphs without #' edge id vector. Vertex names effectively only work in graphs without
#' multiple edges, and must be separated with a \code{|} bar character #' multiple edges, and must be separated with a \code{|} bar character
#' to select an edges that incident to the two given vertices. See #' to select an edges that incident to the two given vertices. See
......
#' @export
gclust.rsvt <- function(glist,r=1,maxsvt=10,nmfout=FALSE,maxit=10000,nmfmethod='lee')
{
if (! requireNamespace("NMF", quietly = TRUE)) {
stop("This function requires the 'NMF' package")
}
# rsvt -- repeated singular value thresholding
# input could be a list of graphs (igraph model)
# or a matrix, where each column corresponds to
# a vectorized version of a graph
if (is.list(glist)) {
Time <- length(glist)
if (class(glist[[1]])=="igraph") {
glist <- lapply(glist,get.adjacency)
}
Xorigin <- sapply(glist,as.vector)
} else {
Xorigin = glist
}
Xraw = Xorigin
Xorigin = Xorigin %*% solve(diag(colSums(Xorigin)))
mysvd = tryCatch(irlba::irlba(Xorigin,r,r,maxit=maxit), error=function(e) svd(Xorigin,r,r))
U = mysvd$u[,1:r,drop=FALSE]
V = mysvd$v[,1:r,drop=FALSE]
if(r == 1) {
S = matrix(mysvd$d[1:r],1,1)
} else {
S = diag(mysvd$d[1:r])
}
maxsvt = ifelse(maxsvt > 0,maxsvt, 1)
for(itr in 1:maxsvt) {
X = U %*% S %*% t(V)
X[X<0]=0
mysvd = tryCatch(irlba::irlba(X,r,r,maxit=maxit), error=function(e) svd(X,r,r))
UU = mysvd$u[,1:r,drop=FALSE]
VV = mysvd$v[,1:r,drop=FALSE]
if(r == 1) {
SS = matrix(mysvd$d[1:r],1,1)
} else {
SS = diag(mysvd$d[1:r])
}
if(norm(UU-U) + norm(VV-V) + norm(SS-S) < 1e-12) {
break
}
U = UU;
V = VV;
S = SS;
}
XX = X %*% solve(diag(colSums(X)))
stash = which(rowSums(XX)==0)
if(length(stash)>0){
XX = XX[-stash,]
}
mynmf = NMF::nmf(XX,rank=r,method=nmfmethod)
WW = matrix(0,nrow=nrow(X),ncol=r)
if(length(stash)>0){
WW[-stash,] = NMF::basis(mynmf)
} else {
WW = NMF::basis(mynmf)
}
HH = coef(mynmf)
if(r > 1) {
HH = diag(colSums(WW)) %*% HH
WW = round(WW %*% solve(diag(colSums(WW))),12)
HH = round(HH %*% solve(diag(colSums(HH))),12)
} else {
HH = colSums(WW) %*% HH
WW = round(WW/colSums(WW),12)
HH = round(HH %*% solve(diag(colSums(HH))),12)
}
if(nmfout)
return(list(nmf=mynmf, W=WW, H=HH, Xorigin=Xraw))
else
return(list(nmf=NULL, W=WW, H=HH, Xorigin=Xraw))
}
#' @export
#' @importFrom stats coef
gclust.app <- function(glist, r=1, nmfout=FALSE, maxit=10000, nmfmethod='lee')
{
if (! requireNamespace("NMF", quietly = TRUE)) {
stop("This function requires the 'NMF' package")
}
# app -- apparent (clustering), i.e. no rsvt
# input could be a list of graphs (igraph model)
# or a matrix, where each column corresponds to
# a vectorized version of a graph
if (is.list(glist)) {
Time <- length(glist)
if (class(glist[[1]])=="igraph") {
glist <- lapply(glist,get.adjacency)
}
Xorigin <- sapply(glist,as.vector)
} else {
Xorigin = glist
}
Xraw = Xorigin
XX = Xorigin %*% solve(diag(colSums(Xorigin)))
stash = which(rowSums(XX)==0)
if(length(stash)>0){
XX = XX[-stash,]
}
mynmf = NMF::nmf(XX,rank=r,method=nmfmethod)
WW = matrix(0,nrow=nrow(Xraw),ncol=r)
if(length(stash)>0){
WW[-stash,] = cbind(NMF::basis(mynmf))
} else {
WW = NMF::basis(mynmf)
}
HH = coef(mynmf)
if(r > 1) {
HH = diag(colSums(WW)) %*% HH
WW = round(WW %*% solve(diag(colSums(WW))),12)
HH = round(HH %*% solve(diag(colSums(HH))),12)
} else {
HH = colSums(WW) %*% HH
WW = round(WW /colSums(WW),12)
HH = round(HH %*% solve(diag(colSums(HH))),12)
}
if(nmfout)
return(list(nmf=mynmf,W=WW,H=HH, Xorigin=Xraw))
else
return(list(nmf=NULL,W=WW,H=HH, Xorigin=Xraw))
}
#' @export
getAICc <- function(gfit) {
# input is the output from a call to gclust.rsvt or gclust.app
Xorigin = gfit$Xorigin
Xmean = gfit$W %*% gfit$H %*% diag(colSums(Xorigin))
Xmean[Xmean<1e-12] = 0
Phat = gfit$W %*% gfit$H
Phat[Phat < 1e-12] = 0
if(ncol(gfit$W) > 1) {
nparams = colSums((1.0*(gfit$W > 0) ))
nparams = nparams %*% diag(1/colSums(Xorigin %*% t(gfit$H)))
nparams = sum(nparams)
} else {
nparams = colSums((1.0*(gfit$W > 0) ))
nparams = nparams/colSums(Xorigin %*% t(gfit$H))
nparams = sum(nparams)
}
zeroprob = which(Phat<1e-12)
if(any(Xorigin[zeroprob]> 1e-12)) {
retval = Inf
} else {
if(length(zeroprob) > 0) {
Phat = Phat[-zeroprob]
}
retval = 2*(nparams) - 2*sum(Phat*log(Phat))
}
data.frame(nclust=ncol(gfit$W), negloglikpart=-2*sum(Phat*log(Phat)), parampart=2*nparams, AIC=retval)
}
...@@ -343,8 +343,9 @@ nexus.format.result <- function(l, name="") { ...@@ -343,8 +343,9 @@ nexus.format.result <- function(l, name="") {
#' #'
#' \code{nexus_get} returns an igraph graph object, or a list of graph objects, #' \code{nexus_get} returns an igraph graph object, or a list of graph objects,
#' if the data set consists of multiple networks. #' if the data set consists of multiple networks.
#' @examples #' @section Examples:
#' \dontrun{nexus_list(tag="weighted") #' \preformatted{
#' nexus_list(tag="weighted")
#' nexus_list(limit=3, order="name") #' nexus_list(limit=3, order="name")
#' nexus_list(limit=3, order="name")[[1]] #' nexus_list(limit=3, order="name")[[1]]
#' nexus_info(2) #' nexus_info(2)
......
...@@ -34,10 +34,8 @@ ...@@ -34,10 +34,8 @@
#' \code{n} colors from the total 8. #' \code{n} colors from the total 8.
#' @return A character vector of RGB color codes. #' @return A character vector of RGB color codes.
#' #'
#' @family palettes #' @section Examples:
#' @export #' \preformatted{
#' @examples
#' \dontrun{
#' library(igraphdata) #' library(igraphdata)
#' data(karate) #' data(karate)
#' karate <- karate %>% #' karate <- karate %>%
...@@ -50,6 +48,9 @@ ...@@ -50,6 +48,9 @@
#' karate$palette <- categorical_pal(length(cl_k)) #' karate$palette <- categorical_pal(length(cl_k))
#' plot(karate) #' plot(karate)
#' } #' }
#'
#' @family palettes
#' @export
categorical_pal <- function(n) { categorical_pal <- function(n) {
......
...@@ -75,8 +75,8 @@ ...@@ -75,8 +75,8 @@
#' @keywords graphs #' @keywords graphs
#' @examples #' @examples
#' #'
#' g <- ring(10) #' g <- make_ring(10)
#' \dontrun{plot(g, layout=layout_with_kk, vertex.color="green")} #' plot(g, layout=layout_with_kk, vertex.color="green")
#' #'
plot.igraph <- function(x, plot.igraph <- function(x,
# SPECIFIC: ##################################### # SPECIFIC: #####################################
......
...@@ -427,7 +427,7 @@ print_all <- function(object, ...) { ...@@ -427,7 +427,7 @@ print_all <- function(object, ...) {
#' The graph summary printed by \code{summary.igraph} (and \code{print.igraph} #' The graph summary printed by \code{summary.igraph} (and \code{print.igraph}
#' and \code{print_all}) consists one or more lines. The first line contains #' and \code{print_all}) consists one or more lines. The first line contains
#' the basic properties of the graph, and the rest contains its attributes. #' the basic properties of the graph, and the rest contains its attributes.
#' Here is an example, a small star graph with weighed directed edges and named #' Here is an example, a small star graph with weighted directed edges and named
#' vertices: \preformatted{ IGRAPH badcafe DNW- 10 9 -- In-star #' vertices: \preformatted{ IGRAPH badcafe DNW- 10 9 -- In-star
#' + attr: name (g/c), mode (g/c), center (g/n), name (v/c), #' + attr: name (g/c), mode (g/c), center (g/n), name (v/c),
#' weight (e/n) } #' weight (e/n) }
......
...@@ -1162,7 +1162,7 @@ constraint <- function(graph, nodes=V(graph), weights=NULL) { ...@@ -1162,7 +1162,7 @@ constraint <- function(graph, nodes=V(graph), weights=NULL) {
#' #'
#' Calculates the reciprocity of a directed graph. #' Calculates the reciprocity of a directed graph.
#' #'
#' The measure of reciprocity defines the proporsion of mutual connections, in #' The measure of reciprocity defines the proportion of mutual connections, in
#' a directed graph. It is most commonly defined as the probability that the #' a directed graph. It is most commonly defined as the probability that the
#' opposite counterpart of a directed edge is also included in the graph. Or in #' opposite counterpart of a directed edge is also included in the graph. Or in
#' adjacency matrix notation: \eqn{\sum_{ij} (A\cdot A')_{ij}}{sum(i, j, #' adjacency matrix notation: \eqn{\sum_{ij} (A\cdot A')_{ij}}{sum(i, j,
......
...@@ -135,12 +135,11 @@ assign(".next", 1, .tkplot.env) ...@@ -135,12 +135,11 @@ assign(".next", 1, .tkplot.env)
#' @seealso \code{\link{plot.igraph}}, \code{\link{layout}} #' @seealso \code{\link{plot.igraph}}, \code{\link{layout}}
#' @export #' @export
#' @keywords graphs #' @keywords graphs
#' @examples #' @section Examples:
#' #' \preformatted{
#' g <- make_ring(10) #' g <- make_ring(10)
#' \dontrun{tkplot(g)} #' tkplot(g)
#' #'
#' \dontrun{
#' ## Saving a tkplot() to a file programatically #' ## Saving a tkplot() to a file programatically
#' g <- make_star(10, center=10) %u% make_ring(9, directed=TRUE) #' g <- make_star(10, center=10) %u% make_ring(9, directed=TRUE)
#' E(g)$width <- sample(1:10, ecount(g), replace=TRUE) #' E(g)$width <- sample(1:10, ecount(g), replace=TRUE)
...@@ -148,11 +147,9 @@ assign(".next", 1, .tkplot.env) ...@@ -148,11 +147,9 @@ assign(".next", 1, .tkplot.env)
#' #'
#' id <- tkplot(g, layout=lay) #' id <- tkplot(g, layout=lay)
#' canvas <- tk_canvas(id) #' canvas <- tk_canvas(id)
#' tkpostscript(canvas, file="/tmp/output.eps") #' tcltk::tkpostscript(canvas, file="/tmp/output.eps")
#' tk_close(id) #' tk_close(id)
#' }
#' #'
#' \dontrun{
#' ## Setting the coordinates and adding a title label #' ## Setting the coordinates and adding a title label
#' g <- make_ring(10) #' g <- make_ring(10)
#' id <- tkplot(make_ring(10), canvas.width=450, canvas.height=500) #' id <- tkplot(make_ring(10), canvas.width=450, canvas.height=500)
...@@ -166,8 +163,8 @@ assign(".next", 1, .tkplot.env) ...@@ -166,8 +163,8 @@ assign(".next", 1, .tkplot.env)
#' width <- as.numeric(tkcget(canvas, "-width")) #' width <- as.numeric(tkcget(canvas, "-width"))
#' height <- as.numeric(tkcget(canvas, "-height")) #' height <- as.numeric(tkcget(canvas, "-height"))
#' tkcreate(canvas, "text", width/2, 25, text="My title", #' tkcreate(canvas, "text", width/2, 25, text="My title",
#' justify="center", font=tcltk::tkfont.create(family="helvetica" #' justify="center", font=tcltk::tkfont.create(family="helvetica",
#' ,size=20,weight="bold")) #' size=20,weight="bold"))
#' } #' }
#' #'
tkplot <- function(graph, canvas.width=450, canvas.height=450, ...) { tkplot <- function(graph, canvas.width=450, canvas.height=450, ...) {
......
#! /bin/sh #! /bin/sh
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.