Learn R Programming

network (version 1.0-1)

is.adjacent: Determine Whether Two Vertices Are Adjacent

Description

is.adjacent returns TRUE iff vi is adjacent to vj in x. Missing edges may be omitted or not, as per na.omit.

Usage

is.adjacent(x, vi, vj, na.omit = TRUE)

Arguments

x
an object of class network
vi
a vertex ID
vj
a second vertex ID
na.omit
logical; should missing edges count when assessing adjacency?

Value

  • A logical, giving the status of the (i,j) edge

Details

Vertex $v$ is said to be adjacent to vertex $v'$ within directed network $G$ iff there exists some edge whose tail set contains $v$ and whose head set contains $v'$. In the undirected case, head and tail sets are exchangeable, and thus $v$ is adjacent to $v'$ if there exists an edge such that $v$ belongs to one endpoint set and $v'$ belongs to the other. (In dyadic graphs, these sets are of cardinality 1, but this may not be the case where hyperedges are admitted.)

Adjacency can also be determined via the extraction/replacement operators. See the associated man page for details.

References

Wasserman, S. and Faust, K. 1994. Social Network Analysis: Methods and Applications. Cambridge: Cambridge University Press.

See Also

get.neighborhood, network.extraction

Examples

Run this code
#Create a very simple graph
g<-network.initialize(3)
add.edge(g,1,2)
is.adjacent(g,1,2)  #TRUE
is.adjacent(g,2,1)  #FALSE
g[1,2]==1           #TRUE
g[2,1]==1           #FALSE

Run the code above in your browser using DataLab