NeighborhoodSubgraph

As of Version 10, all the functionality of the GraphUtilities package is built into the Wolfram System. >>

NeighborhoodSubgraph[g,i,r]

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

NeighborhoodSubgraph[g,i]

gives a subgraph consisting of vertices that can be reached from vertex i.

Details

• NeighborhoodSubgraph functionality is now available in the built-in Wolfram Language function NeighborhoodGraph.
• To use NeighborhoodSubgraph, you first need to load the Graph Utilities Package using Needs["GraphUtilities`"].
• NeighborhoodSubgraph returns a subgraph consisting of vertices that can be reached from a given vertex within certain hops.

Examples

Basic Examples(2)

 In[1]:=

This defines a simple directed graph:

 In[2]:=
 In[3]:=
 In[4]:=
 Out[4]=

This finds a subgraph from vertices that can be reached from vertex 2 within 1 hop:

 In[5]:=
 Out[5]=

NeighborhoodSubgraph has been superseded by NeighborhoodGraph:

 In[1]:=
 Out[1]=
 In[2]:=
 Out[2]=