~mvngu/igraph/doc

« back to all changes in this revision

Viewing changes to interfaces/R/igraph/man/nexus.Rd

  • Committer: Gabor Csardi
  • Date: 2012-02-21 04:05:12 UTC
  • mfrom: (2640.1.1 0.6-main)
  • Revision ID: csardi.gabor@gmail.com-20120221040512-n2orudv0a2cdw3g1
Merged Nexus branch.

Show diffs side-by-side

added added

removed removed

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