This function recursively removes leaves from a graph. A leave is a node with degree 1. The process stops if there is no leaves or the graph is a single node or empty graph.
1 | prune_leaves(graph)
|
graph |
A graph that is stored in an adjacency matrix. |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.