All Projects → goccy → Go Graphviz

goccy / Go Graphviz

Licence: mit
Go bindings for Graphviz

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Labels

Projects that are alternatives of or similar to Go Graphviz

Knife Role Spaghetti
Knife plugin for Chef to draw dependency graphs for roles. Cut through the spaghetti with a knife.
Stars: ✭ 68 (-62.84%)
Mutual labels:  graphviz
Lsofgraph Python
python version of lsof to graphviz parser
Stars: ✭ 106 (-42.08%)
Mutual labels:  graphviz
Wmgraphviz.vim
Vim plugin for Graphviz
Stars: ✭ 142 (-22.4%)
Mutual labels:  graphviz
Memviz
Visualize your Go data structures using graphviz
Stars: ✭ 1,197 (+554.1%)
Mutual labels:  graphviz
Diagram Tools
A number of small tools for generating and manipulating diagrams, mostly based around Graphviz
Stars: ✭ 95 (-48.09%)
Mutual labels:  graphviz
Graphviz.it
Graphviz fiddling website
Stars: ✭ 109 (-40.44%)
Mutual labels:  graphviz
Oligrapher
JavaScript app for displaying annotated network graphs based on data from LittleSis
Stars: ✭ 62 (-66.12%)
Mutual labels:  graphviz
Dot To Ascii
Graphviz to ASCII converter using Graph::Easy
Stars: ✭ 168 (-8.2%)
Mutual labels:  graphviz
Blast Radius
Interactive visualizations of Terraform dependency graphs using d3.js
Stars: ✭ 1,376 (+651.91%)
Mutual labels:  graphviz
Vizdeps
Visualize Leiningen dependencies using Graphviz
Stars: ✭ 131 (-28.42%)
Mutual labels:  graphviz
Grapherl
Create graphs of Erlang systems and programs
Stars: ✭ 78 (-57.38%)
Mutual labels:  graphviz
Graphviz
Stars: ✭ 84 (-54.1%)
Mutual labels:  graphviz
3d Force Graph Vr
3D force-directed graph component in VR
Stars: ✭ 112 (-38.8%)
Mutual labels:  graphviz
Markdeck
presentations as code - author cool slide decks, text-only, offline-ready, collaborative
Stars: ✭ 1,159 (+533.33%)
Mutual labels:  graphviz
Tidyheatmap
Draw heatmap simply using a tidy data frame
Stars: ✭ 151 (-17.49%)
Mutual labels:  graphviz
Graphviz Aws
AWS architecture the easy way
Stars: ✭ 63 (-65.57%)
Mutual labels:  graphviz
Protodot
transforming your .proto files into .dot files (and .svg, .png if you happen to have graphviz installed)
Stars: ✭ 107 (-41.53%)
Mutual labels:  graphviz
Uecs
Ubpa Entity-Component-System (U ECS) in Unity3D-style
Stars: ✭ 174 (-4.92%)
Mutual labels:  graphviz
Psgraph
A set of utilities for working with Graphviz in Powershell
Stars: ✭ 160 (-12.57%)
Mutual labels:  graphviz
Scaladiagrams
Generate class diagrams from scala source code
Stars: ✭ 130 (-28.96%)
Mutual labels:  graphviz

go-graphviz Go GoDoc

Go bindings for Graphviz ( port of version 2.40.1 )

Features

  • No need to install Graphviz library ( brew install graphviz or apt-get install graphviz )
  • Supports parsing for DOT language
  • Supports rendering graph in pure Go
  • Supports switch renderer to your own
  • Supports type safed property setting
  • gvc cgraph cdt are available as sub package

Currently supported Layout

circo dot fdp neato nop nop1 nop2 osage patchwork sfdp twopi

Currently supported format

dot svg png jpg

Installation

$ go get github.com/goccy/go-graphviz

Synopsis

1. Write DOT Graph in Go

package main

import (
  "bytes"
  "fmt"
  "log"

  "github.com/goccy/go-graphviz"
)

func main() {
  g := graphviz.New()
  graph, err := g.Graph()
  if err != nil {
    log.Fatal(err)
  }
  defer func() {
    if err := graph.Close(); err != nil {
      log.Fatal(err)
    }
    g.Close()
  }()
  n, err := graph.CreateNode("n")
  if err != nil {
    log.Fatal(err)
  }
  m, err := graph.CreateNode("m")
  if err != nil {
    log.Fatal(err)
  }
  e, err := graph.CreateEdge("e", n, m)
  if err != nil {
    log.Fatal(err)
  }
  e.SetLabel("e")
  var buf bytes.Buffer
  if err := g.Render(graph, "dot", &buf); err != nil {
    log.Fatal(err)
  }
  fmt.Println(buf.String())
}

2. Parse DOT Graph

path := "/path/to/dot.gv"
b, err := ioutil.ReadFile(path)
if err != nil {
  log.Fatal(err)
}
graph, err := graphviz.ParseBytes(b)

3. Render Graph

g := graphviz.New()
graph, err := g.Graph()
if err != nil {
  log.Fatal(err)
}

// create your graph

// 1. write encoded PNG data to buffer
var buf bytes.Buffer
if err := g.Render(graph, graphviz.PNG, &buf); err != nil {
  log.Fatal(err)
}

// 2. get as image.Image instance
image, err := g.RenderImage(graph)
if err != nil {
  log.Fatal(err)
}

// 3. write to file directly
if err := g.RenderFilename(graph, graphviz.PNG, "/path/to/graph.png"); err != nil {
  log.Fatal(err)
}

Tool

dot

Installation

$ go get github.com/goccy/go-graphviz/cmd/dot

Usage

Usage:
  dot [OPTIONS]

Application Options:
  -T=         specify output format ( currently supported: dot svg png jpg ) (default: dot)
  -K=         specify layout engine ( currently supported: circo dot fdp neato nop nop1 nop2 osage patchwork sfdp twopi )
  -o=         specify output file name

Help Options:
  -h, --help  Show this help message

How it works

go-graphviz has four layers.

  1. graphviz package provides facade interface for manipulating all features of graphviz library
  2. gvc cgraph cdt are sub packages ( FYI: C library section in https://www.graphviz.org/documentation )
  3. internal/ccall package provides bridge interface between Go and C
  4. go-graphviz includes full graphviz sources

License

MIT

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].