 GraphTheory - Maple Programming Help

Home : Support : Online Help : Mathematics : Discrete Mathematics : Graph Theory : GraphTheory Package : GraphTheory/Neighborhood

GraphTheory

 Neighborhood

 Calling Sequence Neighborhood(G, v, s)

Parameters

 G - graph v - vertex s - (optional) the type of neighborhood, either open or closed

Description

 • Neighborhood('G','v') returns the list of neighbors of v in G. If G is directed the directions of arcs are ignored.  An optional third argument, either open or closed, specifies whether to include the vertex v.  The default is open, which does not include v.

Examples

 > $\mathrm{with}\left(\mathrm{GraphTheory}\right):$
 > $\mathrm{with}\left(\mathrm{SpecialGraphs}\right):$
 > $\mathrm{Q3}≔\mathrm{HypercubeGraph}\left(3\right)$
 ${\mathrm{Q3}}{≔}{\mathrm{Graph 1: an undirected unweighted graph with 8 vertices and 12 edge\left(s\right)}}$ (1)
 > $\mathrm{Neighborhood}\left(\mathrm{Q3},"000"\right)$
 $\left[{"001"}{,}{"010"}{,}{"100"}\right]$ (2)
 > $\mathrm{Neighborhood}\left(\mathrm{Q3},"000",\mathrm{closed}\right)$
 $\left[{"000"}{,}{"001"}{,}{"010"}{,}{"100"}\right]$ (3)