百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
R

Ruby-Graphviz

> 编程语言
开源

[MIRROR] 使用 GraphViz 图形化工具的 Ruby 接口

616 stars0 点赞3 次浏览
访问官网GitHub

工具介绍

[MIRROR] 使用 GraphViz 图形化工具的 Ruby 接口

Ruby/GraphViz

Copyright (C) 2004-2018 Gregoire Lejeune

  • Doc : http://rdoc.info/projects/glejeune/Ruby-Graphviz
  • Sources : https://github.com/glejeune/Ruby-Graphviz
  • On Rubygems: https://rubygems.org/gems/ruby-graphviz

INSTALLATION

Add this line to your application's Gemfile:

gem 'ruby-graphviz'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ruby-graphviz

DESCRIPTION

Interface to the GraphViz graphing tool

TODO

  • New FamilyTree

SYNOPSIS

A basic example

ruby
require 'ruby-graphviz'

# Create a new graph
g = GraphViz.new( :G, :type => :digraph )

# Create two nodes
hello = g.add_nodes( "Hello" )
world = g.add_nodes( "World" )

# Create an edge between the two nodes
g.add_edges( hello, world )

# Generate output image
g.output( :png => "hello_world.png" )

The same but with a block

ruby
require 'ruby-graphviz'

GraphViz::new( :G, :type => :digraph ) { |g|
  g.world( :label => "World" )  "Hello" )
}.output( :png => "hello_world.png" )

Or with the DSL

ruby
    require 'ruby-graphviz/dsl'
    digraph :G do
      world[:label => "World"]  "Hello"]

      output :png => "hello_world.png"
    end

Create a graph from a file

ruby
    require 'ruby-graphviz'

    # In this example, hello.dot is :
    #   digraph G {Hello->World;}

    GraphViz.parse( "hello.dot", :path => "/usr/local/bin" ) { |g|
      g.get_node("Hello") { |n|
        n[:label] = "Bonjour"
      }
      g.get_node("World") { |n|
        n[:label] = "Le Monde"
      }
    }.output(:png => "sample.png")

GraphML support

ruby
    require 'ruby-graphviz/graphml'

    g = GraphViz::GraphML.new( "graphml/cluster.graphml" )
    g.graph.output( :path => "/usr/local/bin", :png => "#{$0}.png" )

TOOLS

Ruby/GraphViz also includes :

  • ruby2gv, a simple tool that allows you to create a dependency graph from a ruby script. Example : http://drp.ly/dShaZ
ruby
ruby2gv -Tpng -oruby2gv.png ruby2gv
  • gem2gv, a tool that allows you to create a dependency graph between gems. Example : http://drp.ly/dSj9Y
ruby
gem2gv -Tpng -oruby-graphviz.png ruby-graphviz
  • dot2ruby, a tool that allows you to create a ruby script from a graphviz script
…
  • git2gv, a tool that allows you to show your git commits

  • xml2gv, a tool that allows you to show a xml file as graph.

GRAPH THEORY

…

INSTALLATION

bash
sudo gem install ruby-graphviz

You also need to install GraphViz

On Windows you also need to install win32-open3. This is not an absolute requirement.

LICENCES

Ruby/GraphViz

Ruby/GraphViz is freely distributable according to the terms of the GNU General Public License (see the file 'COPYING').

This program is distributed without any warranty. See the file 'COPYING' for details.

GNU General Public Licence: https://en.wikipedia.org/wiki/Gpl

nothugly.xsl

By Vidar Hokstad and Ryan Shea; Contributions by Jonas Tingborn, Earl Cummings, Michael Kennedy (Graphviz 2.20.2 compatibility, bug fixes, testing, lots of gradients)

Copyright (c) 2009 Vidar Hokstad

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

MIT license: https://en.wikipedia.org/wiki/MIT_License

Contributors

Thanks goes to these wonderful people (emoji key):

Dave Burt

obruening

Chip Malice

Stefan Stüben

oupo

Gregoire Lejeune

Markus Hauck

Khalil Fazal

Kenichi Kamiya

Neven Has

Andrew

Daniel Zollinger

Guilherme Simoes

Oleg Orlov

Gabe Kopley

Jake Goulding

hirochachacha

ronen barzel

Jamison Dance

Joseph Anthony Pasquale Holsten

Miguel Cabrera

Mike Fiedler

Nathan Long

Olle Jonsson

Postmodern

Robert Reiz

Göran Bodenschatz

SHIBATA Hiroshi

moracca

TPei

Villu Orav

David Rodríguez

This project follows the all-contributors specification. Contributions of any kind welcome!

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Ruby

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言