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

NeighborhoodSubgraph


gives a subgraph consists of vertices that can be reached from vertex i within r hops.

gives a subgraph consists of vertices that can be reached from vertex i.
  • returns a subgraph consists of vertices that can be reached from a given vertex within certain hops.
This defines a simple directed graph:
This finds a subgraph from vertices that can be reached from vertex 2 within 3 hop:
This finds a subgraph consists of all vertices that can be reached from vertex 2:
Needs["GraphUtilities`"]
This defines a simple directed graph:
In[2]:=
Click for copyable input
In[3]:=
Click for copyable input
In[4]:=
Click for copyable input
Out[4]=
This finds a subgraph from vertices that can be reached from vertex 2 within 3 hop:
In[5]:=
Click for copyable input
Out[5]=
In[6]:=
Click for copyable input
Out[6]=
This finds a subgraph consists of all vertices that can be reached from vertex 2:
In[7]:=
Click for copyable input
Out[7]=
In[8]:=
Click for copyable input
Out[8]=
This generate a graph by linking a number to itself but with last bit dropped:
This layout the graph:
This shows the subgraphs that can be reached from vertex 1 within 1 to 4 hops: