|
tgen
|
Generation of labeled unrooted trees. More...
Classes | |
| struct | tgen::wtree< VWeight, EWeight > |
| Labeled weighted tree generator. More... | |
| struct | tgen::wtree< VWeight, EWeight >::value |
| Labeled tree value. More... | |
Typedefs | |
| template<typename VWeight> | |
| using | tgen::vtree = wtree<VWeight, int> |
| Vertex-weighted labeled trees. | |
| template<typename EWeight> | |
| using | tgen::etree = wtree<int, EWeight> |
| Edge-weighted labeled trees. | |
| using | tgen::tree = wtree<int, int> |
| Unweighted labeled trees. | |
Generation of labeled unrooted trees.
Vertices are labeled 0 through n-1. Isomorphism is not factored out: two different labeled trees are distinct.
The template tgen::wtree<VWeight, EWeight> is the general generator. It only randomizes the tree shape (edges); vertex and edge weights are not sampled by the generator. Attach them on tgen::wtree::value with tgen::wtree::value::set_vertex_weights / tgen::wtree::value::set_edge_weights when needed. Use tgen::wtree::value::edge_weighted on an edgeless tree to enable weighted add_edge(u, v, w) calls before any edges exist.
Convenient aliases (same constructors and methods as tgen::wtree):
Prints a random labeled tree on 10 vertices with edges (0,1) and (2,3) forced.
Prints a skewed random tree on 10 vertices (elongation 3).
Tree on 4 vertices with string vertex weights attached after generation.
Path tree on 4 vertices with edge weights attached incrementally via edge_weighted.
For labeled graphs (fixed n, m, optional direction and self-loops), see the Graphs module and tgen::wgraph.
| using tgen::etree = wtree<int, EWeight> |
Edge-weighted labeled trees.
Same as tgen::wtree<int, EWeight> (vertex weight type is a dummy int).
| using tgen::tree = wtree<int, int> |
Unweighted labeled trees.
Same as tgen::wtree<int, int> (vertex and edge weight types are a dummy int).
| using tgen::vtree = wtree<VWeight, int> |
Vertex-weighted labeled trees.
Same as tgen::wtree<VWeight, int> (edge weight type is a dummy int).