networks
neighbors
find neighboring vertices, treating all edges as undirected
Calling Sequence
Parameters
Description
Examples
neighbors(v, G)
neighbors(vset, G)
neighbors(G)
v

vertex of G
vset
set of vertices of G
G
graph or network
Important:The networks package has been deprecated. Use the superseding command GraphTheory[Neighbors]instead.
Given a vertex v of a graph G, this routine returns the set of vertices which are at the ends of any edges incident with v, independent of direction.
Given a set of vertices, vset, the neighbors of the subgraph induced by vset are computed.
Directional information can be retrieved through use of the commands head() and tail(). Alternatively, the commands arrivals() and departures() provide information about ``neighbors'' with respect to incoming or outgoing directed edges.
When called with just a graph the actual neighbors table, indexed by vertices, is returned. Caution is required in this instance as this neighbors table is fully maintained by the network primitives such as addedge() and delete(). Specifically, direct assignments are not normally made to this table by the user.
This routine is normally loaded via the command with(networks) but may also be referenced using the full name networks[neighbors](...).
$\mathrm{with}\left(\mathrm{networks}\right)\:$
$G\u2254\mathrm{complete}\left(4\right)\:$
$\mathrm{addvertex}\left(0\,G\right)$
${0}$
$\mathrm{connect}\left(0\,1\,G\,\mathrm{directed}\right)$
${\mathrm{e7}}$
$\mathrm{arrivals}\left(0\,G\right)$
${\varnothing}$
$\mathrm{departures}\left(0\,G\right)$
$\left\{{1}\right\}$
$\mathrm{neighbors}\left(0\,G\right)$
$\mathrm{arrivals}\left(1\,G\right)$
$\left\{{0}{\,}{2}{\,}{3}{\,}{4}\right\}$
$\mathrm{departures}\left(1\,G\right)$
$\left\{{2}{\,}{3}{\,}{4}\right\}$
$\mathrm{neighbors}\left(1\,G\right)$
$\mathrm{arrivals}\left(G\right)$
${table}{}\left(\left[{0}{=}{\varnothing}{\,}{1}{=}\left\{{0}{\,}{2}{\,}{3}{\,}{4}\right\}{\,}{2}{=}\left\{{1}{\,}{3}{\,}{4}\right\}{\,}{3}{=}\left\{{1}{\,}{2}{\,}{4}\right\}{\,}{4}{=}\left\{{1}{\,}{2}{\,}{3}\right\}\right]\right)$
$\mathrm{departures}\left(G\right)$
${table}{}\left(\left[{0}{=}\left\{{1}\right\}{\,}{1}{=}\left\{{2}{\,}{3}{\,}{4}\right\}{\,}{2}{=}\left\{{1}{\,}{3}{\,}{4}\right\}{\,}{3}{=}\left\{{1}{\,}{2}{\,}{4}\right\}{\,}{4}{=}\left\{{1}{\,}{2}{\,}{3}\right\}\right]\right)$
$\mathrm{neighbors}\left(G\right)$
${table}{}\left(\left[{0}{=}\left\{{1}\right\}{\,}{1}{=}\left\{{0}{\,}{2}{\,}{3}{\,}{4}\right\}{\,}{2}{=}\left\{{1}{\,}{3}{\,}{4}\right\}{\,}{3}{=}\left\{{1}{\,}{2}{\,}{4}\right\}{\,}{4}{=}\left\{{1}{\,}{2}{\,}{3}\right\}\right]\right)$
See Also
GraphTheory
GraphTheory[MinimumDegree]
networks(deprecated)[arrivals]
networks(deprecated)[head]
networks(deprecated)[tail]
Download Help Document
What kind of issue would you like to report? (Optional)