as_ids: Convert a vertex or edge sequence to an ordinary vector

Description Usage Arguments Details Value Examples

View source: R/iterators.R

Description

Convert a vertex or edge sequence to an ordinary vector

Usage

1
2
3
4
5
6
7
as_ids(seq)

## S3 method for class 'igraph.vs'
as_ids(seq)

## S3 method for class 'igraph.es'
as_ids(seq)

Arguments

seq

The vertex or edge sequence.

Details

For graphs without names, a numeric vector is returned, containing the internal numeric vertex or edge ids.

For graphs with names, and vertex sequences, the vertex names are returned in a character vector.

For graphs with names and edge sequences, a character vector is returned, with the ‘bar’ notation: a|b means an edge from vertex a to vertex b.

Value

A character or numeric vector, see details below.

Examples

1
2
3
4
5
6
7
g <- make_ring(10)
as_ids(V(g))
as_ids(E(g))

V(g)$name <- letters[1:10]
as_ids(V(g))
as_ids(E(g))

Example output

Attaching package: 'igraph'

The following objects are masked from 'package:stats':

    decompose, spectrum

The following object is masked from 'package:base':

    union

 [1]  1  2  3  4  5  6  7  8  9 10
 [1]  1  2  3  4  5  6  7  8  9 10
 [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j"
 [1] "a|b" "b|c" "c|d" "d|e" "e|f" "f|g" "g|h" "h|i" "i|j" "a|j"

igraph documentation built on May 30, 2017, 2:56 a.m.

Search within the igraph package
Search all R packages, documentation and source code