Skip to content

Latest commit

 

History

History
32 lines (20 loc) · 843 Bytes

forest_graph.md

File metadata and controls

32 lines (20 loc) · 843 Bytes

back to index

forest::graph

forest<NodeT>::graph is a least maximal core graph without ambiguity/repeating nodes/edges possibly with cycles or shared nodes. No cycles and no sharing implies its a tree.

It has the same API as std::unordered_map<NodeT, std::set<std::vector<NodeT>>> and adds root and cycles attributes and extract_trees() method.

attributes

NodeT root;

graph's root node.

std::set cycles;

Set of nodes that lead to a cycle.

methods

std::shared_ptr<forest::tree> extract_trees();

extract_trees extract a tree from a graph.

auto next_g = [](parser<C, T>::pforest::graph& fg) {
	auto tree = fg.extract_trees();
	tree->to_print(cout << "\n\n------\n"), cout << endl;
	return true;
};
f->extract_graphs(f->root(), next_g);