0
\$\begingroup\$

This is the HTree I'm trying to recreate:

In my class of Data Structures I'm learning about trees. They asked us to research trees of our own interest and upon reading I found out about HTrees. As part of the research I need to create a tree in graphviz and here's what I've got so far on dot:

digraph Htree {
    node [style=filled, shape=record];
    graph [ dpi = 300 ]; 
    size ="50";
    nodesep=.1;
    ranksep=.5;
    //node [fontname="Arial"];



    //DX-block
    block_0 -> block_1;
    block_0 -> block_2;
    block_0 -> block_3;

    DX_block [fillcolor=lightgray,shape=record, label="DX-block"];
    DE_block [fillcolor=skyblue,shape=record, label="DE-block"];
    {rank=same;DX_block;DE_block}

    //DX-block -> DE-blocks
    block_1 -> {block_4, block_13, block_9, block_11};
    block_2 -> {block_6, block_7, block_5};
    block_3 -> {block_8, block_10, block_12};

    //DX-block

    block_0 [style=filled, fillcolor=lightgray, shape=record, label="{0|1}|{100|2}|{200|3}", xlabel="Block 0"];
    block_1 [style=filled, fillcolor=lightgray, shape=record, label="{0|4}|{20|13}|{40|9}|{60|11}", xlabel="Block 1"];
    block_2 [style=filled, fillcolor=lightgray, shape=record, label="{100|6}|{120|7}|{150|5}", xlabel="Block 2"];
    block_3 [style=filled, fillcolor=lightgray, shape=record, label="{200|8}|{240|10}|{260|12}", xlabel="Block 3"];


    //DE-block
    block_4 [style=filled, fillcolor=skyblue, shape=record, label="{E1}|{E2}|{...}", xlabel="Block 4"];
    block_13 [style=filled, fillcolor=skyblue, shape=record, label="{E10}|{E11}|{...}", xlabel="Block 13"];
    block_9 [style=filled, fillcolor=skyblue, shape=record, label="{E21}|{E22}|{...}", xlabel="Block 9"];
    block_11 [style=filled, fillcolor=skyblue, shape=record, label="{E41}|{E42}|{...}", xlabel="Block 11"];

    block_6 [style=filled, fillcolor=skyblue, shape=record, label="{E31}|{E32}|{...}", xlabel="Block 6"];
    block_7 [style=filled, fillcolor=skyblue, shape=record, label="{E91}|{E92}|{...}", xlabel="Block 7"];
    block_5 [style=filled, fillcolor=skyblue, shape=record, label="{E51}|{E52}|{...}", xlabel="Block 5"];

    block_8 [style=filled, fillcolor=skyblue, shape=record, label="{E71}|{E72}|{...}", xlabel="Block 8"];
    block_10 [style=filled, fillcolor=skyblue, shape=record, label="{E61}|{E62}|{...}", xlabel="Block 10"];
    block_12 [style=filled, fillcolor=skyblue, shape=record, label="{E81}|{E82}|{...}", xlabel="Block 12"];


}
\$\endgroup\$

migrated from stackoverflow.com Mar 7 at 23:09

This question came from our site for professional and enthusiast programmers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy