August 2019
Intermediate to advanced
242 pages
5h 45m
English
In many cases, it is also very useful to visualize the graph; you can easily do this by adding io or ioutil to your imports and the following line to your code:
ioutil.WriteFile("simple_graph.dot", []byte(g.ToDot()), 0644)
This will produce a DOT file; you can open this in GraphViz, or, more conveniently, convert it to an SVG. You can view it in most modern browsers by installing GraphViz and entering the following in the command line:
dot -Tsvg simple_graph.dot -O
This will produce simple_graph.dot.svg; you can open this in your browser to see a rendering of the graph, as follows:

You can see, in our graph, that we have ...
Read now
Unlock full access