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.tail,e.head))

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