1. 使用 RMarkdown 的 child 参数,进行文档拼接。
  2. 这样拼接以后的笔记方便复习。
  3. 相关问题提交到 Issue

dot draws directed graphs as hierarchies (Gansner, Koutsofios, and North 2015)

1 constrained ranks

1.1 组成部分

# 构建 frame
text_frame = '{
        node [shape=plaintext, fontsize=16];

        /* the time-line graph */
        past -> 1978 -> 1980 -> 1982 -> 1983 -> 1985 -> 1986 ->
                1987 -> 1988 -> 1989 -> 1990 -> "future";

        /* ancestor programs */

        "Bourne sh"; "make"; "SCCS"; "yacc"; "cron"; "Reiser cpp";
        "Cshell"; "emacs"; "build"; "vi"; "<curses>"; "RCS"; "C*";
    }'
# 补充 frame,这里插入的是源头的点
text_circle <- '{ rank = same;
"Software IS"; "Configuration Mgt"; "Architecture & Libraries"; "Process";
};'
# 这里插入的中间的节点
text_node <- 'node [shape=box];
{ rank = same; "past"; "SCCS"; "make"; "Bourne sh"; "yacc"; "cron"; }
{ rank = same; 1978; "Reiser cpp"; "Cshell"; }
{ rank = same; 1980; "build"; "emacs"; "vi"; }
{ rank = same; 1982; "RCS"; "<curses>"; "IMX"; "SYNED"; }
{ rank = same; 1983; "ksh"; "IFS"; "TTU"; }
{ rank = same; 1985; "nmake"; "Peggy"; }
{ rank = same; 1986; "C*"; "ncpp"; "ksh-i"; "<curses-i>"; "PG2"; }
{ rank = same; 1987; "Ansi cpp"; "nmake 2.0"; "3D File System"; "fdelta"; "DAG"; "CSAS";}
{ rank = same; 1988; "CIA"; "SBCS"; "ksh-88"; "PEGASUS/PML"; "PAX"; "backtalk"; }
{ rank = same; 1989; "CIA++"; "APP"; "SHIP"; "DataShare"; "ryacc"; "Mosaic"; }
{ rank = same; 1990; "libft"; "CoShell"; "DIA"; "IFS-i"; "kyacc"; "sfio"; "yeast"; "ML-X"; "DOT"; }
{ rank = same; "future"; "Adv. Software Technology"; }
'
# 补充连接线
text_edge <- '  "PEGASUS/PML" -> "ML-X";
    "SCCS" -> "nmake";
    "SCCS" -> "3D File System";
    "SCCS" -> "RCS";
    "make" -> "nmake";
    "make" -> "build";
    "Bourne sh" -> "Cshell";
    "Bourne sh" -> "ksh";
    "Reiser cpp" -> "ncpp";
    "Cshell" -> "ksh";
    "build" -> "nmake 2.0";
    "emacs" -> "ksh";
    "vi" -> "ksh";
    "vi" -> "<curses>";
    "IFS" -> "<curses-i>";
    "IFS" -> "IFS-i";
    "IFS" -> "sfio";
    "<curses>" -> "<curses-i>";
    "<curses-i>" -> "fdelta";
    "RCS" -> "SBCS";
    "RCS" -> "fdelta";
    "ksh" -> "nmake";
    "ksh" -> "ksh-i";
    "ksh" -> "ksh-88";
    "ksh-i" -> "ksh-88";
    "nmake" -> "ksh";
    "nmake" -> "ncpp";
    "nmake" -> "3D File System";
    "nmake" -> "nmake 2.0";
    "ncpp" -> "Ansi cpp";
    "C*" -> "CSAS";
    "fdelta" -> "SBCS";
    "CSAS" -> "CIA";
    "ksh-88" -> "sfio";
    "ksh-88" -> "Configuration Mgt";
    "ksh-88" -> "Architecture & Libraries";
    "IFS-i" -> "Architecture & Libraries";
    "SYNED" -> "Peggy";
    "Peggy" -> "PEGASUS/PML";
    "Peggy" -> "ryacc";
    "PEGASUS/PML" -> "Architecture & Libraries";
    "yacc" -> "ryacc";
    "ryacc" -> "kyacc";
    "kyacc" -> "Architecture & Libraries";
    "ML-X" -> "Architecture & Libraries";
    "APP" -> "Software IS";
    "SBCS" -> "Configuration Mgt";
    "DAG" -> "Software IS";
    "DAG" -> "DOT";
    "CIA++" -> "Software IS";
    "Ansi cpp" -> "Configuration Mgt";
    "nmake 2.0" -> "Configuration Mgt";
    "3D File System" -> "Configuration Mgt";
    "CIA" -> "CIA++";
    "IMX" -> "TTU";
    "TTU" -> "PG2";
    "PG2" -> "backtalk";
    "backtalk" -> "DataShare";
    "DataShare" -> "Architecture & Libraries";
    "nmake 2.0" -> "CoShell";
    "CIA" -> "DIA";
    "APP" -> "DIA";
    "DAG" -> "DIA";
    "fdelta" -> "PAX";
    "PAX" -> "SHIP";
    "SHIP" -> "Configuration Mgt";
    "DIA" -> "Software IS";
    "DOT" -> "Software IS";
    "libft" -> "Software IS";
    "sfio" -> "Architecture & Libraries";
    "CoShell" -> "Configuration Mgt";
    "CoShell" -> "Architecture & Libraries";
    "Mosaic" -> "Process";
    "cron" -> "yeast";
    "yeast" -> "Process";
    "Software IS" -> "Adv. Software Technology";
    "Configuration Mgt" -> "Adv. Software Technology";
    "Architecture & Libraries" -> "Adv. Software Technology";
    "Process" -> "Adv. Software Technology";'

这是完成的步骤和结构。

1.2 图像迭代

1.3 DOT 文件展示

参考 Gansner, Koutsofios, and North (2015, 17)

## digraph asde91 {ranksep=.75; size = "7.5,7.5";{
##      node [shape=plaintext, fontsize=16];
## 
##      /* the time-line graph */
##      past -> 1978 -> 1980 -> 1982 -> 1983 -> 1985 -> 1986 ->
##              1987 -> 1988 -> 1989 -> 1990 -> "future";
## 
##      /* ancestor programs */
## 
##      "Bourne sh"; "make"; "SCCS"; "yacc"; "cron"; "Reiser cpp";
##      "Cshell"; "emacs"; "build"; "vi"; "<curses>"; "RCS"; "C*";
##  } { rank = same;
## "Software IS"; "Configuration Mgt"; "Architecture & Libraries"; "Process";
## }; node [shape=box];
## { rank = same; "past"; "SCCS"; "make"; "Bourne sh"; "yacc"; "cron"; }
## { rank = same; 1978; "Reiser cpp"; "Cshell"; }
## { rank = same; 1980; "build"; "emacs"; "vi"; }
## { rank = same; 1982; "RCS"; "<curses>"; "IMX"; "SYNED"; }
## { rank = same; 1983; "ksh"; "IFS"; "TTU"; }
## { rank = same; 1985; "nmake"; "Peggy"; }
## { rank = same; 1986; "C*"; "ncpp"; "ksh-i"; "<curses-i>"; "PG2"; }
## { rank = same; 1987; "Ansi cpp"; "nmake 2.0"; "3D File System"; "fdelta"; "DAG"; "CSAS";}
## { rank = same; 1988; "CIA"; "SBCS"; "ksh-88"; "PEGASUS/PML"; "PAX"; "backtalk"; }
## { rank = same; 1989; "CIA++"; "APP"; "SHIP"; "DataShare"; "ryacc"; "Mosaic"; }
## { rank = same; 1990; "libft"; "CoShell"; "DIA"; "IFS-i"; "kyacc"; "sfio"; "yeast"; "ML-X"; "DOT"; }
## { rank = same; "future"; "Adv. Software Technology"; }
##      "PEGASUS/PML" -> "ML-X";
##  "SCCS" -> "nmake";
##  "SCCS" -> "3D File System";
##  "SCCS" -> "RCS";
##  "make" -> "nmake";
##  "make" -> "build";
##  "Bourne sh" -> "Cshell";
##  "Bourne sh" -> "ksh";
##  "Reiser cpp" -> "ncpp";
##  "Cshell" -> "ksh";
##  "build" -> "nmake 2.0";
##  "emacs" -> "ksh";
##  "vi" -> "ksh";
##  "vi" -> "<curses>";
##  "IFS" -> "<curses-i>";
##  "IFS" -> "IFS-i";
##  "IFS" -> "sfio";
##  "<curses>" -> "<curses-i>";
##  "<curses-i>" -> "fdelta";
##  "RCS" -> "SBCS";
##  "RCS" -> "fdelta";
##  "ksh" -> "nmake";
##  "ksh" -> "ksh-i";
##  "ksh" -> "ksh-88";
##  "ksh-i" -> "ksh-88";
##  "nmake" -> "ksh";
##  "nmake" -> "ncpp";
##  "nmake" -> "3D File System";
##  "nmake" -> "nmake 2.0";
##  "ncpp" -> "Ansi cpp";
##  "C*" -> "CSAS";
##  "fdelta" -> "SBCS";
##  "CSAS" -> "CIA";
##  "ksh-88" -> "sfio";
##  "ksh-88" -> "Configuration Mgt";
##  "ksh-88" -> "Architecture & Libraries";
##  "IFS-i" -> "Architecture & Libraries";
##  "SYNED" -> "Peggy";
##  "Peggy" -> "PEGASUS/PML";
##  "Peggy" -> "ryacc";
##  "PEGASUS/PML" -> "Architecture & Libraries";
##  "yacc" -> "ryacc";
##  "ryacc" -> "kyacc";
##  "kyacc" -> "Architecture & Libraries";
##  "ML-X" -> "Architecture & Libraries";
##  "APP" -> "Software IS";
##  "SBCS" -> "Configuration Mgt";
##  "DAG" -> "Software IS";
##  "DAG" -> "DOT";
##  "CIA++" -> "Software IS";
##  "Ansi cpp" -> "Configuration Mgt";
##  "nmake 2.0" -> "Configuration Mgt";
##  "3D File System" -> "Configuration Mgt";
##  "CIA" -> "CIA++";
##  "IMX" -> "TTU";
##  "TTU" -> "PG2";
##  "PG2" -> "backtalk";
##  "backtalk" -> "DataShare";
##  "DataShare" -> "Architecture & Libraries";
##  "nmake 2.0" -> "CoShell";
##  "CIA" -> "DIA";
##  "APP" -> "DIA";
##  "DAG" -> "DIA";
##  "fdelta" -> "PAX";
##  "PAX" -> "SHIP";
##  "SHIP" -> "Configuration Mgt";
##  "DIA" -> "Software IS";
##  "DOT" -> "Software IS";
##  "libft" -> "Software IS";
##  "sfio" -> "Architecture & Libraries";
##  "CoShell" -> "Configuration Mgt";
##  "CoShell" -> "Architecture & Libraries";
##  "Mosaic" -> "Process";
##  "cron" -> "yeast";
##  "yeast" -> "Process";
##  "Software IS" -> "Adv. Software Technology";
##  "Configuration Mgt" -> "Adv. Software Technology";
##  "Architecture & Libraries" -> "Adv. Software Technology";
##  "Process" -> "Adv. Software Technology";}

2 IDE高亮

参考 https://github.com/magneticnorth/magneticnorth.github.io/blob/master/doc/dotguide/asde91.dot

文件 save 为 .dot。 存成这样的文件可以高亮,file.edit("../output/asde91.dot")

3 Use command lines

配置了环境变量还是没用

D:\install\miniconda\pkgs\graphviz-2.38.0-4\Library\bin\graphviz\dot.exe

5 增加标题

参考 Github Issue 182, 标题的参数是label而非title

This is a very late response, but labelloc = t places the title at the top. (Reed 2020)

附录

参考文献

Gansner, Emden R., Eleftherios Koutsofios, and Stephen North. 2015. Drawing Graphs with Dot. http://www.graphviz.org/pdf/dotguide.pdf.

Reed, Dan. 2020. “Title on Graph.” GitHub. 2020. https://github.com/rich-iannone/DiagrammeR/issues/182#issuecomment-582551712.