MCPcopy Create free account
hub / github.com/1a1a11a/libCacheSim / getDOT

Method getDOT

libCacheSim/dataStructure/splaytree.hpp:484–505  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

482
483template <typename K, typename V>
484void SplayTree<K, V>::getDOT(std::ostream &o)
485{
486 o << "digraph G{ graph[ordering = out];" << std::endl;
487 if (node_count_ == 1)
488 o << root_->first << ";" << std::endl;
489 else
490 {
491 for (auto it = begin(); it != end(); ++it)
492 {
493 // 1[label="1 (size=1)"];
494 char out[30];
495 sprintf(out, "%d[label=\"%d (size=%d)\"];", it->first, it->first, (int)it->size);
496 o << out << std::endl;
497 if (it->parent)
498 {
499 std::string type = (iterator(it->parent->right.get()) == it ? "right" : "left");
500 o << it->parent->first << " -> " << it->first << "[label=\"" << type << "\"];" << std::endl;
501 }
502 }
503 }
504 o << "}" << std::endl;
505}
506
507#endif

Callers

nothing calls this directly

Calls 4

beginFunction · 0.85
endFunction · 0.85
iteratorClass · 0.70
getMethod · 0.45

Tested by

no test coverage detected