首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >是否将点转换为ascii: Graph::Easy::Parser::Graphviz无法识别嵌套子图?

是否将点转换为ascii: Graph::Easy::Parser::Graphviz无法识别嵌套子图?
EN

Stack Overflow用户
提问于 2020-01-09 16:05:41
回答 1查看 245关注 0票数 0

我正在尝试使用go-callvis来可视化Go程序的调用图:

代码语言:javascript
复制
go-callvis -debug -group pkg -format dot github.com/syncthing/syncthing/cmd/stindex

输出:https://gist.github.com/quantonganh/d2052370bfcae6b1788465c9b5dcffd9

在此输出中,我希望使用graph-easy将其转换为ASCII图片,而不是图像

代码语言:javascript
复制
❯ graph-easy syncthing-cmd-stindex.dot
Warning: Ignoring unknown attribute 'lheight' for class graph at /Library/Perl/5.18/Graph/Easy/Parser.pm line 1302.
Warning: Ignoring unknown attribute 'lwidth' for class graph at /Library/Perl/5.18/Graph/Easy/Parser.pm line 1302.
Warning: Ignoring unknown attribute 'pad' for class graph at /Library/Perl/5.18/Graph/Easy/Parser.pm line 1302.
Warning: Ignoring unknown attribute 'penwidth' for class graph at /Library/Perl/5.18/Graph/Easy/Parser.pm line 1302.
Warning: Ignoring unknown attribute 'penwidth' for class node at /Library/Perl/5.18/Graph/Easy/Parser.pm line 1302.
Warning: Ignoring unknown attribute 'lheight' for class graph at /Library/Perl/5.18/Graph/Easy/Parser.pm line 1302.
Warning: Ignoring unknown attribute 'lwidth' for class graph at /Library/Perl/5.18/Graph/Easy/Parser.pm line 1302.
',798.1", lwidth=0.37, penwidth=0.8, rank=sink, style=filled, tooltip="package: github.com/syncthing/syncthing/lib/db" ]; "(*github.com/syncthing/syncthing/lib/db.VersionList)

...


112.31,203.1 154.04,203.1 237.26,203.1 299.56,203.1"]; } }' not recognized by Graph::Easy::Parser::Graphviz at /usr/local/bin/graph-easy line 93.

https://gist.github.com/quantonganh/d2052370bfcae6b1788465c9b5dcffd9#file-syncthing-cmd-stindex-dot-L45

你能告诉我问题出在哪里吗?为什么它总是在嵌套子图中的lp属性处失败?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-01-09 20:09:34

通过添加--parse --debug=1

代码语言:javascript
复制
# Parser: found subcluster 'cluster_github.com/syncthing/syncthing/lib/db'
# Creating new group 'cluster_github.com/syncthing/syncthing/lib/db'.
# remapping attributes 'HASH(0x7f89b1a0b7a0)' for graph
#$VAR1 = {
          'fontsize' => '16',
          'fillcolor' => 'lightyellow',
          'label' => '[db',
          'URL' => '/?f=github.com/syncthing/syncthing/lib/db',
          'bb' => '265.57,734.1,493.03,810.1',
          'fontname' => 'bold'
        };

# Parser: new node '", lheight=0.22, lp="'
# Parser: Creating normal node from name ', lheight=0.22, lp='.
# Parser: new node '379.3'
# Parser: Creating normal node from name '379.3'.
# Parsing done.
# Parser cleanup pass
',798.1", lwidth=0.37, penwidth=0.8, rank=sink, style=filled, tooltip="package: github.com/syncthing/syncthing/lib/db" ]; "(*github.com/syncthing/syncthing/lib/db.VersionList)
...

如果仔细查看label值,您会发现它被解析为'[db',而its value[db],因此下面的值被错误地解析:

代码语言:javascript
复制
# Parser: new node '", lheight=0.22, lp="'
# Parser: Creating normal node from name ', lheight=0.22, lp='.
# Parser: new node '379.3'
# Parser: Creating normal node from name '379.3'.
# Parsing done.

我必须删除label值周围的所有方括号,以使其可以完全解析:

代码语言:javascript
复制
# Parser: found subcluster 'cluster_github.com/syncthing/syncthing/lib/db'
# Creating new group 'cluster_github.com/syncthing/syncthing/lib/db'.
# remapping attributes 'HASH(0x7fe097c34a38)' for graph
#$VAR1 = {
          'fontname' => 'bold',
          'URL' => '/?f=github.com/syncthing/syncthing/lib/db',
          'style' => 'filled',
          'bb' => '265.57,734.1,493.03,810.1',
          'rank' => 'sink',
          'lwidth' => '0.37',
          'label' => 'db',
          'lp' => '379.3,798.1',
          'fillcolor' => 'lightyellow',
          'tooltip' => 'package: github.com/syncthing/syncthing/lib/db',
          'lheight' => '0.22',
          'penwidth' => '0.8',
          'fontsize' => '16'
        };
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59659560

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档