Adaptagrams
|
#include <peeling.h>
Public Member Functions | |
NodeBuckets (Graph &graph) | |
Initialize a set of node buckets for the given Graph. More... | |
NodesById | takeLeaves (void) |
Return a copy of the bucket of leaves, and clear the latter. | |
bool | moveNode (id_type id, unsigned oldDegree, unsigned newDegree) |
Move a node from one bucket to another. More... | |
void | severNodes (const NodesById &nodes) |
Sever the given Nodes from our Graph. More... | |
For sorting all the nodes of a graph into "buckets" according to their degree. You can take all the leaves (degree-1 nodes) and you can move a node from one bucket to another.
NodeBuckets::NodeBuckets | ( | Graph & | graph | ) |
Initialize a set of node buckets for the given Graph.
Creates buckets for all degrees up to the Graph's max degree, and populates these. Each bucket contains a NodesById map.
References dialect::Graph::getNodeLookup().
bool NodeBuckets::moveNode | ( | id_type | id, |
unsigned | oldDegree, | ||
unsigned | newDegree | ||
) |
Move a node from one bucket to another.
[in] | id | The ID of the Node to be moved. |
[in] | oldDegree | The bucket in which the Node should be found. |
[in] | newDegree | The bucket to which the Node should be moved. |
Referenced by severNodes().
void NodeBuckets::severNodes | ( | const NodesById & | nodes | ) |
Sever the given Nodes from our Graph.
References moveNode(), dialect::Graph::removeNodes(), and dialect::Graph::severNodeNotingNeighbours().
Referenced by dialect::peel().