Graphviz and ascii output

后端 未结 5 1880
余生分开走
余生分开走 2021-01-30 12:50

Is it possible to draw ASCII diagram using Graphviz?

Something like that:

digraph
{
  this -> is
  this -> a
  a -> test
}

Giv

相关标签:
5条回答
  • 2021-01-30 13:01

    Here is equivalent commands for linux:

    First install cpanminus

    sudo apt install cpanminus
    

    After you can install GraphEasy

    sudo cpanm Graph::Easy
    

    Here is a sample usage

    cat input.dot | graph-easy --from=dot --as_ascii
    
    0 讨论(0)
  • 2021-01-30 13:02

    If you are not perl averse, graph-easy (and the associated Graph::Easy package) can do exactly that:

    http://search.cpan.org/~tels/Graph-Easy/

    http://search.cpan.org/~tels/Graph-Easy/bin/graph-easy

    On Mac you can install this with Homebrew and cpan:

    brew install cpanminus
    cpan Graph::Easy
    

    It's easy to invoke after installation:

    cat dotfile.dot   | /opt/local/libexec/perl5.12/sitebin/graph-easy
    
    0 讨论(0)
  • 2021-01-30 13:03

    Another option to use Graph::Easy's ASCII functionality is directly from your browser through this small service that I hosted:

    https://dot-to-ascii.ggerganov.com

    0 讨论(0)
  • 2021-01-30 13:06

    Using graph-easy via docker. You can install whalebrew and use it to run graph-easy without installing too much dependancies on your local machine other than whalebrew and docker.

    on MacOS with homebrew install docker

    $ brew install docker
    $ docker -v      # check if docker is running
    

    Install whalebrew - https://github.com/whalebrew/whalebrew (check installation alternatives)

    $ brew install whalebrew
    

    Install graph-easy via whalebrew

    $ whalebrew install tsub/graph-easy
    

    Now run it via

    $ echo '[a]->[b]' | graph-easy
    
    +---+     +---+
    | a | --> | b |
    +---+     +---+
    
    0 讨论(0)
  • 2021-01-30 13:07

    By now, in ubuntu, you can install and use graph-easy directly:

    > sudo apt install libgraph-easy-perl
    [...]
    
    > graph-easy dotfile.dot 
    +----+     +------+
    | is | <-- | this |
    +----+     +------+
                 |
                 |
                 v
               +------+
               |  a   |
               +------+
                 |
                 |
                 v
               +------+
               | test |
               +------+
    
    0 讨论(0)
提交回复
热议问题