Skip to content

Simple tool for generating tree visualizations with Graphviz

License

Notifications You must be signed in to change notification settings

Theodus/treeviz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

treeviz

Generate Graphviz Dot for a tree-based data structure from JSON

Notes

  • The JSON layout is chosen to be easily generated, not easily written directly
  • More human-friendly input formats may be added as desired

Examples

demo

JSON input:

{ "id": "Tree", "children": [
  { "id": "a", "children": [
    { "id": "c", "children": [
      { "id": "i", "children": [] },
      { "id": "j", "children": [] }]
    },
    { "id": "d", "children": [
      { "id": "k", "children": [] },
      { "id": "l", "children": [] } ]
    }]
  },
  { "id": "b", "children": [
    { "id": "g", "children": [
      { "id": "m", "children": [] },
      { "id": "n", "children": [] },
      { "id": "o", "children": [] }]
    },
    { "id": "h", "children": [] }]
  }]
}

Graphviz Dot output:

digraph Tree {
  rankdir=TD;
  node [shape=record,width=0.1,height=0.1];

  n [label="<p0> a | <p1> b"];
  n:p0 -> n_0 [headport=n];
  n:p1 -> n_1 [headport=n];
  n_0 [label="<p0> c | <p1> d"];
  n_0:p0 -> n_0_0 [headport=n];
  n_0:p1 -> n_0_1 [headport=n];
  n_0_0 [label="<p0> i | <p1> j"];
  n_0_1 [label="<p0> k | <p1> l"];
  n_1 [label="<p0> g | <p1> h"];
  n_1:p0 -> n_1_0 [headport=n];
  n_1_0 [label="<p0> m | <p1> n | <p2> o"];
}

About

Simple tool for generating tree visualizations with Graphviz

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages