Function Repository Resource:

GraphRemoveLooseEnds

Source Notebook

Remove low-valence vertices in a graph

Contributed by: Nikolay Murzin

ResourceFunction["GraphRemoveLooseEnds"][g]

removes low-valence vertices in the graph g.

Details

Low-valence vertices are vertices with only one edge incident to them.

Examples

Basic Examples (2) 

Remove low-valence vertices from a graph:

In[1]:=
g = NestGraph[n |-> {2 n + 1, 3 n + 1}, {1}, 8, ImageSize -> {150, 150}];
Row[{g, ResourceFunction["GraphRemoveLooseEnds"][g, All]}]
Out[2]=

Removing the loose ends allows the loops within the graph to be more prominent:

In[3]:=
ResourceFunction["GraphRemoveLooseEnds"][
 NestGraph[n |-> {2 n + 1, 3 n + 1}, {1}, 12], All]
Out[3]=

Version History

  • 1.0.0 – 05 October 2021

License Information