aGrUM 3.1.1
a C++ library for (probabilistic) graphical models
fastGraph_tpl.h File Reference
#include <algorithm>
#include <cstdint>
#include <string>
#include <utility>
#include <vector>
#include <agrum/base/graphs/fastGraph.h>
#include <agrum/base/core/utils_string.h>
Include dependency graph for fastGraph_tpl.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  gum
 gum is the global namespace for all aGrUM entities
namespace  gum::detail

Enumerations

enum class  gum::detail::FastGraphOp : std::uint8_t { gum::detail::None , gum::detail::Arc , gum::detail::RevArc , gum::detail::Edge }
 which operator (if any) precedes a node token in a fastGraph chain More...

Functions

std::size_t gum::detail::fastGraphFindDash (std::string_view chain, std::size_t from)
 Finds the first '-' at bracket-depth 0, starting at from, skipping any '['...']' or '{'...'}' span.
std::vector< std::pair< std::string, FastGraphOp > > gum::detail::fastGraphTokenize (std::string_view chain)
 Scans one ";"-delimited chain, splitting it into node tokens while remembering, for each token, whether it was preceded by "->" (Arc), "<-" (RevArc) or "-" (Edge).
bool gum::detail::fastGraphIsNodeIdToken (const std::string &token)
 true if token must be read as a NodeId (non-negative integer)
template<typename GRAPH_TYPE>
NodeId gum::detail::fastGraphBuildNode (GRAPH_TYPE &g, const std::string &token, bool useIds)
 gets or creates the node denoted by token, in NodeId or name mode
template<typename Resolve, typename AddArc, typename AddEdge>
void gum::detail::fastGraphWalkTokens (const std::vector< std::pair< std::string, FastGraphOp > > &tokens, std::string_view desc, Resolve resolve, AddArc addArc, AddEdge addEdge)
 Walks one already-tokenized chain (see fastGraphTokenize()), resolving each token to a NodeId via resolve and wiring consecutive nodes via addArc / addEdge according to the operator preceding each token.
template<GUM_NodeGraphable GRAPH_TYPE = MixedGraph>
GRAPH_TYPE gum::fastGraph (std::string_view desc)
 Builds a GRAPH_TYPE from a DOT-like textual description.