vcount(graph)
ecount(graph)
neighbors(graph, v, mode = 1)
is.directed(graph)
are.connected(graph, v1, v2)
get.edge(graph, id)
v1
to v2
are searched.v1
to v2
are searched.vcount
and ecount
return integer
constants. neighbors
returns an integer
vector. is.directed
and are.connected
return boolean
constants. get.edge
returns a numeric vector of length two. vcount
gives the number of vertices in the graph.
ecount
gives the number of edges in the graph.
neighbors
gives the neighbors of a vertex. The vertices
connected by multiple edges are listed as many times as the number of
connecting edges.
is.directed
gives whether the graph is directed or not. It just
gives its directed
attribute.
are.connected
decides whether there is an edge from v1
to v2
.
get.edge
returns the end points of the edge with the supplied
edge id. For directed graph the source vertex comes first, for
undirected graphs, the order is arbitrary.
graph
g <- graph.ring(10)
vcount(g)
ecount(g)
neighbors(g, 5)
are.connected(g, 1, 2)
are.connected(g, 2, 4)
Run the code above in your browser using DataLab