GraphViz is one of my favorite technologies, and I’ve been very happy to incorporate it into my work on SwiftDoc, a new documentation generator for the Swift programming language.

In the course of my work, I made an open source package for defining graphs, encoding them to DOT, and rendering with GraphViz. You can find it here on GitHub:

Here’s an example of how it’s used:

```
import GraphViz
var graph = Graph(directed: true)
let a = Node("a"), b = Node("b"), c = Node("c")
graph.append(Edge(from: a, to: b))
graph.append(Edge(from: a, to: c))
var b_c = Edge(from: b, to: c)
b_c.constraint = false
graph.append(b_c)
// Produce DOT language representation
let dot = DOTEncoder().encode(graph)
// Render image using dot layout algorithm
let data = try! graph.render(using: .dot, to: .svg)
let svg = String(data: data, encoding: .utf8)!
```

I tried my best to support all of the available node, edge, and graph attributes in a coherent way, but please let me know if I missed a few or if anything looks out of place.

Anyway, If you’re developing a macOS or iPhone app, or perhaps using Swift server-side, I’d encourage you to take a look and let me know what you think. Thanks!