Last active
November 12, 2020 01:01
-
-
Save Green-Sky/d41f7ff7f03e2adf2d0775d8d05faaa0 to your computer and use it in GitHub Desktop.
Generates a .dot GraphViz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Generates a .dot GraphViz | |
// license is CC0 (this means public domain in most countries) | |
std::ostream& operator<<(std::ostream& out, const std::vector<entt::organizer::vertex>& nodes) { | |
out << "digraph EnTT_organizer {\n"; | |
for (size_t i = 0; i < nodes.size(); i++) { | |
out << "n" << i << "[label=\"" << (nodes[i].name() == nullptr ? "NoName" : nodes[i].name()) << "\"];\n"; | |
} | |
for (size_t i = 0; i < nodes.size(); i++) { | |
for (const size_t child : nodes[i].children()) { | |
out << "n" << child << " -> " << "n" << i << ";\n"; | |
} | |
} | |
out << "}"; | |
return out; | |
} | |
std::ostream& operator<<(std::ostream& out, /*const*/ entt::organizer& org) { | |
const auto nodes = org.graph(); | |
out << nodes; | |
return out; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment