Bertini 2 d882924 (2026-10-06 19:56 UTC)
Numerical algebraic geometry library (C++ core)
Loading...
Searching...
No Matches
canonical_encoding.hpp
Go to the documentation of this file.
1//This file is part of Bertini 2.
2//
3//canonical_encoding.hpp is free software: you can redistribute it and/or modify
4//it under the terms of the GNU General Public License as published by
5//the Free Software Foundation, either version 3 of the License, or
6//(at your option) any later version.
7//
8//canonical_encoding.hpp is distributed in the hope that it will be useful,
9//but WITHOUT ANY WARRANTY; without even the implied warranty of
10//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11//GNU General Public License for more details.
12//
13//You should have received a copy of the GNU General Public License
14//along with canonical_encoding.hpp. If not, see <http://www.gnu.org/licenses/>.
15//
16// Copyright(C) Bertini2 Development Team
17//
18// See <http://www.gnu.org/licenses/> for a copy of the license,
19// as well as COPYING. Bertini2 is provided with permitted
20// additional terms in the b2/licenses/ directory.
21
56
57#pragma once
58
59#include <map>
60#include <memory>
61#include <ostream>
62#include <string>
63
65
66namespace bertini {
67namespace node {
68
76{
78 std::map<Node const*, unsigned> seen;
80 unsigned next_index = 0;
81};
82
94void EncodeCanonical(std::shared_ptr<Node> const& root, std::ostream& out, EncodingContext& ctx);
95
102std::string CanonicalEncoding(std::shared_ptr<Node> const& root);
103
104} // namespace node
105} // namespace bertini
Definition canonical.hpp:56
std::string CanonicalEncoding(std::shared_ptr< Node > const &root)
The canonical encoding of a single tree as a string (fresh context).
void EncodeCanonical(std::shared_ptr< Node > const &root, std::ostream &out, EncodingContext &ctx)
Append the canonical encoding of the DAG rooted at root to out.
Definition algorithm_builder.hpp:36
Defines the abstract Node base class.
Traversal state for one canonical-encoding pass: the back-reference table.
Definition canonical_encoding.hpp:76
unsigned next_index
The index the next first-encountered node will receive (traversal order).
Definition canonical_encoding.hpp:80
std::map< Node const *, unsigned > seen
First-encounter index of each node visited so far, keyed by object identity.
Definition canonical_encoding.hpp:78