nxpp
Header-only graph utilities on top of Boost Graph Library
Loading...
Searching...
No Matches
dot.hpp File Reference

Graphviz DOT export helpers. More...

#include "../graph.hpp"
#include <any>
#include <cctype>
#include <filesystem>
#include <fstream>
#include <map>
#include <optional>
#include <sstream>
#include <stdexcept>
#include <string>
#include <vector>
Include dependency graph for dot.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  nxpp::viz::DotOptions
 Controls the lightweight DOT export surface. More...
 

Typedefs

using nxpp::viz::detail::DotAttrList = std::vector< std::pair< std::string, std::string > >
 

Enumerations

enum class  nxpp::viz::DotLayout {
  Dot , Neato , Fdp , Sfdp ,
  Circo
}
 Graphviz layout engines commonly used to render DOT output.
 

Functions

std::string nxpp::viz::detail::quote_dot_string (const std::string &value)
 
bool nxpp::viz::detail::is_plain_dot_id (const std::string &value)
 
bool nxpp::viz::detail::is_dot_number (const std::string &value)
 
std::string nxpp::viz::detail::graph_id (const std::string &value)
 
std::string nxpp::viz::detail::attr_value (const std::string &value)
 
const char * nxpp::viz::detail::dot_layout_name (DotLayout layout)
 
bool nxpp::viz::detail::has_dot_attr (const DotAttrList &attrs, const std::string &key)
 
void nxpp::viz::detail::append_dot_attr (DotAttrList &attrs, const std::string &key, const std::string &value)
 
std::string nxpp::viz::detail::format_dot_attrs (const DotAttrList &attrs)
 
template<typename T >
std::string nxpp::viz::detail::to_string (const T &value)
 
template<typename T >
std::optional< std::string > nxpp::viz::detail::any_attr_as_string (const std::any &value)
 
std::string nxpp::viz::detail::any_attr_value (const std::any &value)
 
template<typename NodeID , typename EdgeWeight , bool Directed, bool Multi, bool Weighted, typename OutEdgeSelector , typename VertexSelector >
std::string nxpp::viz::to_dot (const Graph< NodeID, EdgeWeight, Directed, Multi, Weighted, OutEdgeSelector, VertexSelector > &graph, const DotOptions &options={})
 Serializes a graph to Graphviz DOT.
 
template<typename NodeID , typename EdgeWeight , bool Directed, bool Multi, bool Weighted, typename OutEdgeSelector , typename VertexSelector >
void nxpp::viz::write_dot (const Graph< NodeID, EdgeWeight, Directed, Multi, Weighted, OutEdgeSelector, VertexSelector > &graph, const std::filesystem::path &output_path, const DotOptions &options={})
 Writes Graphviz DOT output to a filesystem path.
 

Detailed Description

Graphviz DOT export helpers.

Function Documentation

◆ to_dot()

template<typename NodeID , typename EdgeWeight , bool Directed, bool Multi, bool Weighted, typename OutEdgeSelector , typename VertexSelector >
std::string nxpp::viz::to_dot ( const Graph< NodeID, EdgeWeight, Directed, Multi, Weighted, OutEdgeSelector, VertexSelector > &  graph,
const DotOptions options = {} 
)

Serializes a graph to Graphviz DOT.

The visualization layer uses public node IDs directly as quoted DOT node IDs. For weighted graphs, the built-in weight can be emitted as both weight and label so Graphviz layout tools retain weight semantics and SVG output also shows the numeric weight.

References nxpp::viz::to_dot().

Referenced by nxpp::viz::to_dot().