All Projects → SwiftDocOrg → Graphviz

SwiftDocOrg / Graphviz

Licence: mit
A Swift package for working with GraphViz

Programming Languages

swift
15916 projects

Labels

Projects that are alternatives of or similar to Graphviz

Vzl
💠 DOT Language Live Editor (GraphViz)
Stars: ✭ 83 (-63.91%)
Mutual labels:  graphviz
Scaladiagrams
Generate class diagrams from scala source code
Stars: ✭ 130 (-43.48%)
Mutual labels:  graphviz
Uecs
Ubpa Entity-Component-System (U ECS) in Unity3D-style
Stars: ✭ 174 (-24.35%)
Mutual labels:  graphviz
Diagram Tools
A number of small tools for generating and manipulating diagrams, mostly based around Graphviz
Stars: ✭ 95 (-58.7%)
Mutual labels:  graphviz
Graphviz.it
Graphviz fiddling website
Stars: ✭ 109 (-52.61%)
Mutual labels:  graphviz
Wmgraphviz.vim
Vim plugin for Graphviz
Stars: ✭ 142 (-38.26%)
Mutual labels:  graphviz
Memviz
Visualize your Go data structures using graphviz
Stars: ✭ 1,197 (+420.43%)
Mutual labels:  graphviz
Gofsm
a featured FSM that can export state images
Stars: ✭ 222 (-3.48%)
Mutual labels:  graphviz
3d Force Graph Vr
3D force-directed graph component in VR
Stars: ✭ 112 (-51.3%)
Mutual labels:  graphviz
Dot To Ascii
Graphviz to ASCII converter using Graph::Easy
Stars: ✭ 168 (-26.96%)
Mutual labels:  graphviz
Blast Radius
Interactive visualizations of Terraform dependency graphs using d3.js
Stars: ✭ 1,376 (+498.26%)
Mutual labels:  graphviz
Protodot
transforming your .proto files into .dot files (and .svg, .png if you happen to have graphviz installed)
Stars: ✭ 107 (-53.48%)
Mutual labels:  graphviz
Tidyheatmap
Draw heatmap simply using a tidy data frame
Stars: ✭ 151 (-34.35%)
Mutual labels:  graphviz
Graphviz
Stars: ✭ 84 (-63.48%)
Mutual labels:  graphviz
Go Graphviz
Go bindings for Graphviz
Stars: ✭ 183 (-20.43%)
Mutual labels:  graphviz
Grapherl
Create graphs of Erlang systems and programs
Stars: ✭ 78 (-66.09%)
Mutual labels:  graphviz
Vizdeps
Visualize Leiningen dependencies using Graphviz
Stars: ✭ 131 (-43.04%)
Mutual labels:  graphviz
Kaitai struct
Kaitai Struct: declarative language to generate binary data parsers in C++ / C# / Go / Java / JavaScript / Lua / Perl / PHP / Python / Ruby
Stars: ✭ 2,736 (+1089.57%)
Mutual labels:  graphviz
Diagrams
🎨 Diagram as Code for prototyping cloud system architectures
Stars: ✭ 15,756 (+6750.43%)
Mutual labels:  graphviz
Psgraph
A set of utilities for working with Graphviz in Powershell
Stars: ✭ 160 (-30.43%)
Mutual labels:  graphviz

GraphViz

CI Documentation

A Swift package for working with GraphViz.

Requirements

  • Swift 5.2+
  • GraphViz (only for rendering)

Usage

import GraphViz
import DOT

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)

// Render image using dot layout algorithm
let data = try! DOTRenderer(using: .dot, to: .svg).render(graph: graph)
let svg = String(data: data, encoding: .utf8)!
Example GraphViz Output
digraph {
  a -> b
  a -> c
  b -> c [constraint=false]
}

Note: The render(using:to:) method requires that the GraphViz binary corresponding to the specified layout algorithm is accessible from the current $PATH.

Using Function Builders, Custom Operators, and Fluent Attribute Setters

To use the following interface, add "GraphVizBuilder" to your package's dependencies and replace import GraphViz with import GraphVizBuilder as needed.

import GraphVizBuilder

let graph = Graph(directed: true) {
    "a" --> "b"
    "a" --> "c"
    ("b" --> "c").constraint(false)
}

Note: Swift 5.1 may require explicit typecast expressions in order to reconcile use of custom edge operators like -->. (error: ambiguous reference to member '-->')

Installation

Swift Package Manager

Add the GraphViz package to your target dependencies in Package.swift:

import PackageDescription

let package = Package(
  name: "YourProject",
  dependencies: [
    .package(
        url: "https://github.com/SwiftDocOrg/GraphViz",
        from: "0.2.0"
    ),
  ]
)

Add GraphViz as a dependency to your target(s):

targets: [
.target(
    name: "YourTarget",
    dependencies: ["GraphViz"]),

To render graphs to SVG, PNG, and other formats, you must have GraphViz executables (e.g. dot) installed on your system and accessible from $PATH. You can install GraphViz from the command line:

# macOS
$ brew install graphviz

# Linux (Ubuntu)
$ sudo apt-get install graphviz

License

MIT

Contact

Mattt (@mattt)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].