NeighborhoodSubgraph


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


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

DetailsDetails

  • To use , you first need to load the Graph Utilities Package using Needs["GraphUtilities`"].
  • returns a subgraph consisting of vertices that can be reached from a given vertex within certain hops.

ExamplesExamplesopen allclose all

Basic Examples (1)Basic Examples (1)

In[1]:=
Click for copyable input

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 hops:

In[5]:=
Click for copyable input
Out[5]=
In[6]:=
Click for copyable input
Out[6]=

This finds a subgraph consisting 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]=
New to Mathematica? Find your learning path »
Have a question? Ask support »