1% Generated by roxygen2: do not edit by hand
2% Please edit documentation in R/nexus.R
3\name{print.nexusDatasetInfo}
4\alias{print.nexusDatasetInfo}
5\alias{summary.nexusDatasetInfoList}
6\alias{print.nexusDatasetInfoList}
7\alias{nexus_list}
8\alias{nexus}
9\alias{nexus.list}
10\alias{nexus.info}
11\alias{nexus.get}
12\alias{nexus.search}
13\alias{nexus_info}
14\alias{nexus_get}
15\alias{nexus_search}
16\alias{nexusDatasetInfo}
17\alias{[.nexusDatasetInfoList}
18\title{Query and download from the Nexus network repository}
19\usage{
20\method{print}{nexusDatasetInfo}(x, ...)
21
22\method{summary}{nexusDatasetInfoList}(object, ...)
23
24\method{print}{nexusDatasetInfoList}(x, ...)
25
26nexus_list(
27  tags = NULL,
28  offset = 0,
29  limit = 10,
30  operator = c("or", "and"),
31  order = c("date", "name", "popularity"),
32  nexus.url = igraph_opt("nexus.url")
33)
34
35nexus_info(id, nexus.url = igraph_opt("nexus.url"))
36
37nexus_get(
38  id,
39  offset = 0,
40  order = c("date", "name", "popularity"),
41  nexus.url = igraph_opt("nexus.url")
42)
43
44nexus_search(
45  q,
46  offset = 0,
47  limit = 10,
48  order = c("date", "name", "popularity"),
49  nexus.url = igraph_opt("nexus.url")
50)
51
52\method{[}{nexusDatasetInfoList}(x, i)
53}
54\arguments{
55\item{x, object}{The \code{nexusDatasetInfo} object to print.}
56
57\item{\dots}{Currently ignored.}
58
59\item{tags}{A character vector, the tags that are searched. If not given (or
60\code{NULL}), then all datasets are listed.}
61
62\item{offset}{An offset to select part of the results. Results are listed
63from \code{offset}+1.}
64
65\item{limit}{The maximum number of results to return.}
66
67\item{operator}{A character scalar. If \sQuote{or} (the default), then all
68datasets that have at least one of the given tags, are returned. If it if
69\sQuote{and}, then only datasets that have all the given tags, are returned.}
70
71\item{order}{The ordering of the results, possible values are:
72\sQuote{date}, \sQuote{name}, \sQuote{popularity}.}
73
74\item{nexus.url}{The URL of the Nexus server. Don't change this from the
75default, unless you set up your own Nexus server.}
76
77\item{id}{The numeric or character id of the data set to query or download.
78Instead of the data set ids, it is possible to supply a
79\code{nexusDatasetInfo} or \code{nexusDatasetInfoList} object here directly
80and then the query is done on the corresponding data set(s).}
81
82\item{q}{Nexus search string. See examples below.}
83
84\item{i}{Index.}
85}
86\value{
87\code{nexus_list} and \code{nexus_search} return a list of
88\code{nexusDatasetInfo} objects. The list also has these attributes:
89\describe{ \item{size}{The number of data sets returned by the query.}
90\item{totalsize}{The total number of data sets found for the query.}
91\item{offset}{The offset parameter of the query.} \item{limit}{The limit
92parameter of the query.} }
93
94\code{nexus_info} returns a single \code{nexusDatasetInfo} object.
95
96\code{nexus_get} returns an igraph graph object, or a list of graph objects,
97if the data set consists of multiple networks.
98}
99\description{
100The Nexus network repository is an online collection of network data sets.
101These functions can be used to query it and download data from it, directly
102as an igraph graph.
103}
104\details{
105Nexus is an online repository of networks, with an API that allow
106programmatic queries against it, and programmatic data download as well.
107
108The \code{nexus_list} and \code{nexus_info} functions query the online
109database. They both return \code{nexusDatasetInfo} objects.
110\code{nexus_info} returns more information than \code{nexus_list}.
111
112\code{nexus_search} searches Nexus, and returns a list of data sets, as
113\code{nexusDatasetInfo} objects. See below for some search examples.
114
115\code{nexus_get} downloads a data set from Nexus, based on its numeric id,
116or based on a Nexus search string. For search strings, only the first search
117hit is downloaded, but see also the \code{offset} argument. (If there are
118not data sets found, then the function returns an error.)
119
120The \code{nexusDatasetInfo} objects returned by \code{nexus_list} have the
121following fields: \describe{
122  \item{id}{The numeric id of the dataset.}
123  \item{sid}{The character id of the dataset.}
124  \item{name}{Character scalar, the name of the dataset.}
125  \item{vertices/edges}{Character, the number of vertices and edges in
126    the graph(s). Vertices and edges are separated by a  slash, and if
127    the data set consists of multiple networks, then they are separated
128    by spaces.}
129  \item{tags}{Character vector, the tags of the dataset. Directed graph
130    have the tags \sQuote{directed}. Undirected graphs are tagged
131    as \sQuote{undirected}. Other common tags are: \sQuote{weighted},
132    \sQuote{bipartite}, \sQuote{social network}, etc.}
133  \item{networks}{The ids and names of the networks in the data set. The
134    numeric and character id are separated by a slash, and multiple networks
135    are separated by spaces.}
136}
137
138\code{nexusDatasetInfo} objects returned by \code{nexus_info} have the
139following additional fields: \describe{
140  \item{date}{Character scalar, e.g. \sQuote{2011-01-09}, the date when
141    the dataset was added to the database.}
142  \item{formats}{Character vector, the data formats in which the data set is
143    available. The various formats are separated by semicolons.}
144  \item{licence}{Character scalar, the licence of the dataset.}
145  \item{licence url}{Character scalar, the URL of the licence of the
146    dataset. Please make sure you consult this before using a dataset.}
147  \item{summary}{Character scalar, the short description of the dataset,
148    this is usually a single sentence.}
149  \item{description}{Character scalar, the full description of the
150    dataset.}
151  \item{citation}{Character scalar, the paper(s) describing the
152    dataset. Please cite these papers if you are using the dataset in your
153    research, the licence of most datasets requires this.}
154  \item{attributes}{A list of lists, each list entry is a graph, vertex
155    or edge attribute and has the following entries: \describe{
156      \item{type}{Type of the attribute, either \sQuote{graph},
157        \sQuote{vertex} or \sQuote{edge}.}
158      \item{datatype}{Data type of the attribute, currently it can be
159        \sQuote{numeric} and \sQuote{string}.}
160      \item{name}{Character scalar, the name of the attribute.}
161      \item{description}{Character scalar, the description of the
162        attribute.}
163    }
164  }
165}
166
167The results of the Nexus queries are printed to the screen in a consise
168format, similar to the format of igraph graphs. A data set list (typically
169the result of \code{nexus_list} and \code{nexus_search}) looks like this:
170\preformatted{NEXUS 1-5/18 -- data set list
171[1] kaptail.4         39/109-223   #18 Kapferer tailor shop
172[2] condmatcollab2003 31163/120029 #17 Condensed matter collaborations+
173[3] condmatcollab     16726/47594  #16 Condensed matter collaborations+
174[4] powergrid         4941/6594    #15 Western US power grid
175[5] celegansneural    297/2359     #14 C. Elegans neural network }
176Each line here represents a data set, and the following information is
177given about them: the character id of the data set (e.g. \code{kaptail}
178or \code{powergrid}), the number of vertices and number of edges in the
179graph of the data sets.  For data sets with multiple graphs, intervals
180are given here. Then the numeric id of the data set and the remaining
181space is filled with the name of the data set.
182
183Summary information about an individual Nexus data set is printed as
184\preformatted{NEXUS B--- 39 109-223 #18 kaptail -- Kapferer tailor shop
185+ tags: directed; social network; undirected
186+ nets: 1/KAPFTI2; 2/KAPFTS2; 3/KAPFTI1; 4/KAPFTS1}
187This is very similar to the header that is used for printing igraph
188graphs, but there are some differences as well. The four characters
189after the \code{NEXUS} word give the most important properties of the
190graph(s): the first is \sQuote{\code{U}} for undirected and
191\sQuote{\code{D}} for directed graphs, and \sQuote{\code{B}} if the data
192set contains both directed and undirected graphs. The second is
193\sQuote{\code{N}} named graphs. The third character is \sQuote{\code{W}}
194for weighted graphs, the fourth is \sQuote{\code{B}} if the data set
195contains bipartite graphs. Then the number of vertices and number of
196edges are printed, for data sets with multiple graphs, the smallest and
197the largest values are given. Then comes the numeric id, and the string
198id of the data set. The end of the first line contains the name of the
199data set. The second row lists the data set tags, and the third row the
200networks that are included in the data set.
201
202Detailed data set information is printed similarly, but it contains more
203fields.
204}
205\section{Examples}{
206
207\preformatted{
208nexus_list(tag="weighted")
209nexus_list(limit=3, order="name")
210nexus_list(limit=3, order="name")[[1]]
211nexus_info(2)
212g <- nexus_get(2)
213summary(g)
214
215## Data sets related to 'US':
216nexus_search("US")
217
218## Search for data sets that have 'network' in their name:
219nexus_search("name:network")
220
221## Any word can match
222nexus_search("blog or US or karate")
223}
224}
225
226