This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

NeighborhoodGraph

NeighborhoodGraph
gives the graph neighborhood vertex v in the graph g.
NeighborhoodGraph
gives the graph neighborhood of the that can be vertices, edges, or subgraphs of g.
NeighborhoodGraph
gives the graph neighborhood of the vertices and edges that match the pattern patt.
NeighborhoodGraph
gives the neighborhood up to distance k.
  • The neighborhood graph for a vertex v is given by vertices adjacent to v and the edges connecting them.
  • The neighborhood graph for an edge e is the neighborhood graph for the vertices of e.
  • The neighborhood graph for a subgraph h is the neighborhood graph for the vertices in h.
  • The neighborhood graph at distance k is the neighborhood graph for the vertices of the neighborhood graph at distance k-1.
  • The default value for k is .
Give the neighborhood from vertex 1 in a graph:
From a set of vertices:
Give the neighborhood up to distance k from the vertices:
Give the neighborhood from vertex 1 in a graph:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
From a set of vertices:
In[3]:=
Click for copyable input
Out[3]=
 
Give the neighborhood up to distance k from the vertices:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
NeighborhoodGraph works with undirected graphs:
Directed graphs:
NeighborhoodGraph works with vertices:
Edges:
Use patterns to specify a set of vertices:
Works with large graphs:
Highlight the neighborhood from the vertices in CompleteGraph:
Manipulate the neighborhood of vertices:
The neighborhood of a vertex in a complete graph is the graph itself:
Pick out random neighborhoods from a grid:
Subtract random neighborhoods from a grid:
New in 8