You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -61,10 +61,80 @@ Create a build folder, navigate there, run cmake and build the tree-tests target
61
61
You might have to adapt the linker line for gtest, if you built it yourself and didn't install it into your system.
62
62
If you want to generate the pretty drawings, install cairo, pull the submodule and pass INT_TREE_DRAW_EXAMPLES=on to the cmake command line to generate a drawings/make_drawings executeable.
63
63
64
+
## Draw Dot Graph
65
+
This draws a dot graph of the tree:
66
+
```c++
67
+
#include<interval-tree/interval_tree.hpp>
68
+
#include<interval-tree/dot_graph.hpp>
69
+
70
+
intmain()
71
+
{
72
+
using namespace lib_interval_tree;
73
+
interval_tree_t<int> tree;
74
+
75
+
tree.insert(make_safe_interval<int>(21, 16)); // make_safe_interval swaps low and high if not in right order.
76
+
tree.insert({8, 9});
77
+
tree.insert({25, 30});
78
+
tree.insert({5, 8});
79
+
tree.insert({15, 23});
80
+
tree.insert({17, 19});
81
+
tree.insert({26, 26});
82
+
tree.insert({0, 3});
83
+
tree.insert({6, 10});
84
+
tree.insert({19, 20});
85
+
86
+
draw_dot_graph(
87
+
std::cout,
88
+
tree,
89
+
{
90
+
// digraph or graph?
91
+
.digraph = true,
92
+
93
+
// graph name
94
+
.name = "G",
95
+
96
+
// extra node attributes
97
+
.extra_node_attributes = {"color=red"},
98
+
99
+
// extra graph statements
100
+
.extra_statements = {"rankdir=LR"},
101
+
102
+
// put space after comma of interval label? (a,b) vs (a, b)
103
+
.space_after_comma = false,
104
+
105
+
// left brace override, otherwise determined from interval kind
106
+
.left_brace = std::nullopt,
107
+
108
+
// right brace override, otherwise determined from interval kind
0 commit comments