Import Dot Graphs

We import Graphviz dot as translated to json. Here we do their one example which hints at possibilities. graphviz

echo 'digraph { a->b }' | dot -Tdot_json | pbcopy

{
  "name": "%3",
  "directed": true,
  "strict": false,
  "_subgraph_cnt": 0,
  "objects": [
    {
      "_gvid": 0,
      "name": "a",
      "label": "\\N"
    },
    {
      "_gvid": 1,
      "name": "b",
      "label": "\\N"
    }
  ],
  "edges": [
    {
      "_gvid": 0,
      "tail": 0,
      "head": 1
    }
  ]
}

http://hsc.fed.wiki/assets/scripts/import-foreign-json.html HEIGHT 240

Add code here to extract nodes and relations from _json_ and add them to _graph_. Remember node ids in _nids_.

json.objects.forEach(n => graph.addNode('Node',{name:n.name}))

json.edges.forEach(e => graph.addRel('Edge',e.head,e.tail))

digraph { layout = dot; overlap = false; splines=true node [shape=box style=filled fillcolor=gold] rankdir=LR node [fillcolor=palegreen] 0 [label="Node\na" tooltip="name: a"] 1 [label="Node\nb" tooltip="name: b"] 1->0 [label="Edge" labeltooltip=""] }