Skip to content

Instantly share code, notes, and snippets.

View Sand3r-'s full-sized avatar

Michał Gallus Sand3r-

View GitHub Profile
Sand3r- / GraphPrinter.h
Last active March 28, 2020 12:23
C++: Print tree to a dot/graphviz graph. Derive from this class and generate graph of a tree or a node hierarchy of your choice and save it to a .dot file.
#pragma once
#include <sstream>
#include <fstream>
#include <string>
// Inherit from this class, passing your node type as T
// template argument. Override GetNumChildren, GetChildNode
// and GetNodeName to provide a way of accessing node's name,
// its children and number of them.
template<typename T>