-
-
Notifications
You must be signed in to change notification settings - Fork 203
/
Copy pathV.Rd
77 lines (69 loc) · 2.34 KB
/
V.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/iterators.R
\name{V}
\alias{V}
\title{Vertices of a graph}
\usage{
V(graph)
}
\arguments{
\item{graph}{The graph}
}
\value{
A vertex sequence containing all vertices, in the order
of their numeric vertex ids.
}
\description{
Create a vertex sequence (vs) containing all vertices of a graph.
}
\details{
A vertex sequence is just what the name says it is: a sequence of
vertices. Vertex sequences are usually used as igraph function arguments
that refer to vertices of a graph.
A vertex sequence is tied to the graph it refers to: it really denoted
the specific vertices of that graph, and cannot be used together with
another graph.
At the implementation level, a vertex sequence is simply a vector
containing numeric vertex ids, but it has a special class attribute
which makes it possible to perform graph specific operations on it, like
selecting a subset of the vertices based on graph structure, or vertex
attributes.
A vertex sequence is most often created by the \code{V()} function. The
result of this includes all vertices in increasing vertex id order. A
vertex sequence can be indexed by a numeric vector, just like a regular
R vector. See \code{\link{[.igraph.vs}} and additional links to other
vertex sequence operations below.
}
\section{Indexing vertex sequences}{
Vertex sequences mostly behave like regular vectors, but there are some
additional indexing operations that are specific for them;
e.g. selecting vertices based on graph structure, or based on vertex
attributes. See \code{\link{[.igraph.vs}} for details.
}
\section{Querying or setting attributes}{
Vertex sequences can be used to query or set attributes for the
vertices in the sequence. See \code{\link[=$.igraph.vs]{$.igraph.vs()}} for details.
}
\examples{
# Vertex ids of an unnamed graph
g <- make_ring(10)
V(g)
# Vertex ids of a named graph
g2 <- make_ring(10) \%>\%
set_vertex_attr("name", value = letters[1:10])
V(g2)
}
\seealso{
Other vertex and edge sequences:
\code{\link{E}()},
\code{\link{as_ids}()},
\code{\link{igraph-es-attributes}},
\code{\link{igraph-es-indexing2}},
\code{\link{igraph-es-indexing}},
\code{\link{igraph-vs-attributes}},
\code{\link{igraph-vs-indexing2}},
\code{\link{igraph-vs-indexing}},
\code{\link{print.igraph.es}()},
\code{\link{print.igraph.vs}()}
}
\concept{vertex and edge sequences}