How can I adjust the nodes in this dot program into a 2 by 3 table?
up vote
2
down vote
favorite
I use graphviz to draw a diagram.
The placement of the nodes are not ideal. I would like the six nodes to be roughly placed in a 2 by 3 table:
file_in stdin_in string_in
file_out stdout_out variable_out
I have tried to add weights to some edges but still fails to move the nodes into such a table. See my dot program below. Thanks.
digraph G {
/* directly betw inputs */
node [color=black]
string_in -> stdin_in [label="redirection"];
file_in -> stdin_in [label="redirection"];
stdin_in -> file_in [label="device file /dev/stdin, or arg -", weight=8];
stdin_in -> string_in [label="xargs"];
/* directly betw outputs */
node [color=red]
edge [color=red]
stdout_out -> file_out [label="redirection" fontcolor="red"];
file_out -> stdout_out [label="/dev/stdout or arg -" fontcolor="red"];
/* directly from input to output */
edge [color=blue]
stdin_in -> stdout_out [label="cat or tee" fontcolor="blue" weight=8];
stdin_in -> file_out [label = "tee > /dev/null" fontcolor = "blue"];
string_in -> stdout_out [label="echo -n" fontcolor="blue" weight=2];
file_in -> stdout_out [label="cat" fontcolor="blue"];
file_in -> file_out [label="none" fontcolor="blue"];
string_in -> variable_out [label="assignment" fontcolor="blue"];
/* directly from output to input */
edge [color=green]
stdout_out -> stdin_in [label="pipe" fontcolor="green"];
stdout_out -> file_in [label="process substitution" fontcolor="green"];
stdout_out -> string_in [label="command substitution" fontcolor="green"];
file_out -> file_in [label="none" fontcolor="green"];
variable_out -> string_in [label="parameter expansion" fontcolor="green"];
}
graphviz dot
add a comment |
up vote
2
down vote
favorite
I use graphviz to draw a diagram.
The placement of the nodes are not ideal. I would like the six nodes to be roughly placed in a 2 by 3 table:
file_in stdin_in string_in
file_out stdout_out variable_out
I have tried to add weights to some edges but still fails to move the nodes into such a table. See my dot program below. Thanks.
digraph G {
/* directly betw inputs */
node [color=black]
string_in -> stdin_in [label="redirection"];
file_in -> stdin_in [label="redirection"];
stdin_in -> file_in [label="device file /dev/stdin, or arg -", weight=8];
stdin_in -> string_in [label="xargs"];
/* directly betw outputs */
node [color=red]
edge [color=red]
stdout_out -> file_out [label="redirection" fontcolor="red"];
file_out -> stdout_out [label="/dev/stdout or arg -" fontcolor="red"];
/* directly from input to output */
edge [color=blue]
stdin_in -> stdout_out [label="cat or tee" fontcolor="blue" weight=8];
stdin_in -> file_out [label = "tee > /dev/null" fontcolor = "blue"];
string_in -> stdout_out [label="echo -n" fontcolor="blue" weight=2];
file_in -> stdout_out [label="cat" fontcolor="blue"];
file_in -> file_out [label="none" fontcolor="blue"];
string_in -> variable_out [label="assignment" fontcolor="blue"];
/* directly from output to input */
edge [color=green]
stdout_out -> stdin_in [label="pipe" fontcolor="green"];
stdout_out -> file_in [label="process substitution" fontcolor="green"];
stdout_out -> string_in [label="command substitution" fontcolor="green"];
file_out -> file_in [label="none" fontcolor="green"];
variable_out -> string_in [label="parameter expansion" fontcolor="green"];
}
graphviz dot
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I use graphviz to draw a diagram.
The placement of the nodes are not ideal. I would like the six nodes to be roughly placed in a 2 by 3 table:
file_in stdin_in string_in
file_out stdout_out variable_out
I have tried to add weights to some edges but still fails to move the nodes into such a table. See my dot program below. Thanks.
digraph G {
/* directly betw inputs */
node [color=black]
string_in -> stdin_in [label="redirection"];
file_in -> stdin_in [label="redirection"];
stdin_in -> file_in [label="device file /dev/stdin, or arg -", weight=8];
stdin_in -> string_in [label="xargs"];
/* directly betw outputs */
node [color=red]
edge [color=red]
stdout_out -> file_out [label="redirection" fontcolor="red"];
file_out -> stdout_out [label="/dev/stdout or arg -" fontcolor="red"];
/* directly from input to output */
edge [color=blue]
stdin_in -> stdout_out [label="cat or tee" fontcolor="blue" weight=8];
stdin_in -> file_out [label = "tee > /dev/null" fontcolor = "blue"];
string_in -> stdout_out [label="echo -n" fontcolor="blue" weight=2];
file_in -> stdout_out [label="cat" fontcolor="blue"];
file_in -> file_out [label="none" fontcolor="blue"];
string_in -> variable_out [label="assignment" fontcolor="blue"];
/* directly from output to input */
edge [color=green]
stdout_out -> stdin_in [label="pipe" fontcolor="green"];
stdout_out -> file_in [label="process substitution" fontcolor="green"];
stdout_out -> string_in [label="command substitution" fontcolor="green"];
file_out -> file_in [label="none" fontcolor="green"];
variable_out -> string_in [label="parameter expansion" fontcolor="green"];
}
graphviz dot
I use graphviz to draw a diagram.
The placement of the nodes are not ideal. I would like the six nodes to be roughly placed in a 2 by 3 table:
file_in stdin_in string_in
file_out stdout_out variable_out
I have tried to add weights to some edges but still fails to move the nodes into such a table. See my dot program below. Thanks.
digraph G {
/* directly betw inputs */
node [color=black]
string_in -> stdin_in [label="redirection"];
file_in -> stdin_in [label="redirection"];
stdin_in -> file_in [label="device file /dev/stdin, or arg -", weight=8];
stdin_in -> string_in [label="xargs"];
/* directly betw outputs */
node [color=red]
edge [color=red]
stdout_out -> file_out [label="redirection" fontcolor="red"];
file_out -> stdout_out [label="/dev/stdout or arg -" fontcolor="red"];
/* directly from input to output */
edge [color=blue]
stdin_in -> stdout_out [label="cat or tee" fontcolor="blue" weight=8];
stdin_in -> file_out [label = "tee > /dev/null" fontcolor = "blue"];
string_in -> stdout_out [label="echo -n" fontcolor="blue" weight=2];
file_in -> stdout_out [label="cat" fontcolor="blue"];
file_in -> file_out [label="none" fontcolor="blue"];
string_in -> variable_out [label="assignment" fontcolor="blue"];
/* directly from output to input */
edge [color=green]
stdout_out -> stdin_in [label="pipe" fontcolor="green"];
stdout_out -> file_in [label="process substitution" fontcolor="green"];
stdout_out -> string_in [label="command substitution" fontcolor="green"];
file_out -> file_in [label="none" fontcolor="green"];
variable_out -> string_in [label="parameter expansion" fontcolor="green"];
}
graphviz dot
graphviz dot
edited Nov 22 at 0:01
asked Nov 21 at 23:34
Ben
1577
1577
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
The key point here is using rank = same
; I have added this instruction at the top of your code. I have also increased the distance between the two rank levels so that there is more space for the edge labels. I have also changed the weights you had given to the edges in order to have a matrix like appearance.
Two more things I would recommend:
- rather than the HTML-like syntax for the node, use the standard graphviz format; matter of taste, but I find it easier to read and it is more flexible, see (How shall escape `>` in an edge label?),
- when creating edges from nodes lower in the hierarchy to higher ones, don't use
b->a
, rather writea->b[dir="back"]
; this avoids graphviz getting confused when the number of nodes increases
I have not completely edited the file, as it is not strictly necessary for the two items just mentioned - here the job I have done:
digraph G {
# layout
ranksep = 2
{ rank = same; file_in stdin_in string_in }
{ rank = same; file_out stdout_out variable_out }
/* directly betw inputs */
node [color=black]
string_in -> stdin_in [label="redirection"];
file_in -> stdin_in [label="redirection"];
stdin_in -> file_in [label="device file /dev/stdin, or arg -"]
stdin_in -> string_in [label="xargs"];
/* directly betw outputs */
node [color=red]
edge [color=red]
stdout_out -> file_out [label=<<font color="red">redirection</font>>];
file_out -> stdout_out [label=<<font color="red">/dev/stdout or arg -</font>>];
/* directly from input to output */
edge [color=blue]
stdin_in -> stdout_out [label=<<font color="blue">cat or tee</font>> weight = 10];
# stdin_in -> file_out [label=<<font color="blue">tee /dev/null</font>>];
stdin_in -> file_out[ label = "tee > /dev/null" fontcolor = "blue" ];
string_in -> stdout_out [label=<<font color="blue">echo -n</font>> ];
file_in -> stdout_out [label=<<font color="blue">cat</font>> ];
file_in -> file_out [label = "none" fontcolor = "blue" weight = 10];
string_in -> variable_out [label = "assignment" fontcolor = "blue" weight = 10 ];
/* directly from output to input */
edge [color=green]
stdout_out -> stdin_in [label=<<font color="green">pipe</font>>];
stdout_out -> file_in [label=<<font color="green">process substitution</font>>];
stdout_out -> string_in [label=<<font color="green">command substitution</font>>];
file_in -> file_out [label="none" fontcolor="green" dir = back ];
variable_out -> string_in [label=<<font color="green">parameter expansion</font>>];
}
which gives you
Thank you so much! :) If I may ask, (1) Is it correct thatrank
is used for ensuring the nodes with the same rank are always in the same row? (2) Is there no similar way to ensure nodes always in the same column, and the only way is by adjusting edge weights? (3) "when creating edges from nodes lower in the hierarchy to higher ones, don't use b->a, rather write a->b[dir="back"]; this avoids graphviz getting confused when the number of nodes increases". What kind of confusion is it? Thanks
– Ben
Nov 22 at 1:33
1
To your questions: (1) in principle yes,graphviz
needs to betoldwhat you wnat to haveon the same level - (2) There are other ways but depends upon the context - (3)b->a
tellsgraphviz
thatb
is hierarchically abovea
whixh may be contrary to what you want; in most cases, the context will rectify this but I have had situations where one edge in the wrong direction completely messed up the graph; as "good practice" keep the hierarchicalorder and the direction of the arrow separate
– vaettchen
Nov 22 at 15:08
Thanks. To ensure nodes always in the same column, "there are other ways but depends upon the context". If I may ask, what are some other ways commonly used? Is there no way likerank
which can enforce that?
– Ben
Nov 22 at 15:21
1
Sorry but thi is really not so easy. Just a few items to check: Make sure you declare your nodes in the right order -graphviz
draws them as they are declared. Quite often, invisible edges help to maintain order. Subgraphs can be a kind of last resort. But "no size fits all".
– vaettchen
Nov 22 at 15:31
Thanks. Just in case as a backup plan, I am also trying to figure out a way to manually adjust the SVG file originally created by GraphViz, in Inkscape or similar software. If you happen to know something about that, I'd appreciate your consideration too: unix.stackexchange.com/questions/483314/…
– Ben
Nov 22 at 16:01
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53421930%2fhow-can-i-adjust-the-nodes-in-this-dot-program-into-a-2-by-3-table%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
The key point here is using rank = same
; I have added this instruction at the top of your code. I have also increased the distance between the two rank levels so that there is more space for the edge labels. I have also changed the weights you had given to the edges in order to have a matrix like appearance.
Two more things I would recommend:
- rather than the HTML-like syntax for the node, use the standard graphviz format; matter of taste, but I find it easier to read and it is more flexible, see (How shall escape `>` in an edge label?),
- when creating edges from nodes lower in the hierarchy to higher ones, don't use
b->a
, rather writea->b[dir="back"]
; this avoids graphviz getting confused when the number of nodes increases
I have not completely edited the file, as it is not strictly necessary for the two items just mentioned - here the job I have done:
digraph G {
# layout
ranksep = 2
{ rank = same; file_in stdin_in string_in }
{ rank = same; file_out stdout_out variable_out }
/* directly betw inputs */
node [color=black]
string_in -> stdin_in [label="redirection"];
file_in -> stdin_in [label="redirection"];
stdin_in -> file_in [label="device file /dev/stdin, or arg -"]
stdin_in -> string_in [label="xargs"];
/* directly betw outputs */
node [color=red]
edge [color=red]
stdout_out -> file_out [label=<<font color="red">redirection</font>>];
file_out -> stdout_out [label=<<font color="red">/dev/stdout or arg -</font>>];
/* directly from input to output */
edge [color=blue]
stdin_in -> stdout_out [label=<<font color="blue">cat or tee</font>> weight = 10];
# stdin_in -> file_out [label=<<font color="blue">tee /dev/null</font>>];
stdin_in -> file_out[ label = "tee > /dev/null" fontcolor = "blue" ];
string_in -> stdout_out [label=<<font color="blue">echo -n</font>> ];
file_in -> stdout_out [label=<<font color="blue">cat</font>> ];
file_in -> file_out [label = "none" fontcolor = "blue" weight = 10];
string_in -> variable_out [label = "assignment" fontcolor = "blue" weight = 10 ];
/* directly from output to input */
edge [color=green]
stdout_out -> stdin_in [label=<<font color="green">pipe</font>>];
stdout_out -> file_in [label=<<font color="green">process substitution</font>>];
stdout_out -> string_in [label=<<font color="green">command substitution</font>>];
file_in -> file_out [label="none" fontcolor="green" dir = back ];
variable_out -> string_in [label=<<font color="green">parameter expansion</font>>];
}
which gives you
Thank you so much! :) If I may ask, (1) Is it correct thatrank
is used for ensuring the nodes with the same rank are always in the same row? (2) Is there no similar way to ensure nodes always in the same column, and the only way is by adjusting edge weights? (3) "when creating edges from nodes lower in the hierarchy to higher ones, don't use b->a, rather write a->b[dir="back"]; this avoids graphviz getting confused when the number of nodes increases". What kind of confusion is it? Thanks
– Ben
Nov 22 at 1:33
1
To your questions: (1) in principle yes,graphviz
needs to betoldwhat you wnat to haveon the same level - (2) There are other ways but depends upon the context - (3)b->a
tellsgraphviz
thatb
is hierarchically abovea
whixh may be contrary to what you want; in most cases, the context will rectify this but I have had situations where one edge in the wrong direction completely messed up the graph; as "good practice" keep the hierarchicalorder and the direction of the arrow separate
– vaettchen
Nov 22 at 15:08
Thanks. To ensure nodes always in the same column, "there are other ways but depends upon the context". If I may ask, what are some other ways commonly used? Is there no way likerank
which can enforce that?
– Ben
Nov 22 at 15:21
1
Sorry but thi is really not so easy. Just a few items to check: Make sure you declare your nodes in the right order -graphviz
draws them as they are declared. Quite often, invisible edges help to maintain order. Subgraphs can be a kind of last resort. But "no size fits all".
– vaettchen
Nov 22 at 15:31
Thanks. Just in case as a backup plan, I am also trying to figure out a way to manually adjust the SVG file originally created by GraphViz, in Inkscape or similar software. If you happen to know something about that, I'd appreciate your consideration too: unix.stackexchange.com/questions/483314/…
– Ben
Nov 22 at 16:01
add a comment |
up vote
1
down vote
accepted
The key point here is using rank = same
; I have added this instruction at the top of your code. I have also increased the distance between the two rank levels so that there is more space for the edge labels. I have also changed the weights you had given to the edges in order to have a matrix like appearance.
Two more things I would recommend:
- rather than the HTML-like syntax for the node, use the standard graphviz format; matter of taste, but I find it easier to read and it is more flexible, see (How shall escape `>` in an edge label?),
- when creating edges from nodes lower in the hierarchy to higher ones, don't use
b->a
, rather writea->b[dir="back"]
; this avoids graphviz getting confused when the number of nodes increases
I have not completely edited the file, as it is not strictly necessary for the two items just mentioned - here the job I have done:
digraph G {
# layout
ranksep = 2
{ rank = same; file_in stdin_in string_in }
{ rank = same; file_out stdout_out variable_out }
/* directly betw inputs */
node [color=black]
string_in -> stdin_in [label="redirection"];
file_in -> stdin_in [label="redirection"];
stdin_in -> file_in [label="device file /dev/stdin, or arg -"]
stdin_in -> string_in [label="xargs"];
/* directly betw outputs */
node [color=red]
edge [color=red]
stdout_out -> file_out [label=<<font color="red">redirection</font>>];
file_out -> stdout_out [label=<<font color="red">/dev/stdout or arg -</font>>];
/* directly from input to output */
edge [color=blue]
stdin_in -> stdout_out [label=<<font color="blue">cat or tee</font>> weight = 10];
# stdin_in -> file_out [label=<<font color="blue">tee /dev/null</font>>];
stdin_in -> file_out[ label = "tee > /dev/null" fontcolor = "blue" ];
string_in -> stdout_out [label=<<font color="blue">echo -n</font>> ];
file_in -> stdout_out [label=<<font color="blue">cat</font>> ];
file_in -> file_out [label = "none" fontcolor = "blue" weight = 10];
string_in -> variable_out [label = "assignment" fontcolor = "blue" weight = 10 ];
/* directly from output to input */
edge [color=green]
stdout_out -> stdin_in [label=<<font color="green">pipe</font>>];
stdout_out -> file_in [label=<<font color="green">process substitution</font>>];
stdout_out -> string_in [label=<<font color="green">command substitution</font>>];
file_in -> file_out [label="none" fontcolor="green" dir = back ];
variable_out -> string_in [label=<<font color="green">parameter expansion</font>>];
}
which gives you
Thank you so much! :) If I may ask, (1) Is it correct thatrank
is used for ensuring the nodes with the same rank are always in the same row? (2) Is there no similar way to ensure nodes always in the same column, and the only way is by adjusting edge weights? (3) "when creating edges from nodes lower in the hierarchy to higher ones, don't use b->a, rather write a->b[dir="back"]; this avoids graphviz getting confused when the number of nodes increases". What kind of confusion is it? Thanks
– Ben
Nov 22 at 1:33
1
To your questions: (1) in principle yes,graphviz
needs to betoldwhat you wnat to haveon the same level - (2) There are other ways but depends upon the context - (3)b->a
tellsgraphviz
thatb
is hierarchically abovea
whixh may be contrary to what you want; in most cases, the context will rectify this but I have had situations where one edge in the wrong direction completely messed up the graph; as "good practice" keep the hierarchicalorder and the direction of the arrow separate
– vaettchen
Nov 22 at 15:08
Thanks. To ensure nodes always in the same column, "there are other ways but depends upon the context". If I may ask, what are some other ways commonly used? Is there no way likerank
which can enforce that?
– Ben
Nov 22 at 15:21
1
Sorry but thi is really not so easy. Just a few items to check: Make sure you declare your nodes in the right order -graphviz
draws them as they are declared. Quite often, invisible edges help to maintain order. Subgraphs can be a kind of last resort. But "no size fits all".
– vaettchen
Nov 22 at 15:31
Thanks. Just in case as a backup plan, I am also trying to figure out a way to manually adjust the SVG file originally created by GraphViz, in Inkscape or similar software. If you happen to know something about that, I'd appreciate your consideration too: unix.stackexchange.com/questions/483314/…
– Ben
Nov 22 at 16:01
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
The key point here is using rank = same
; I have added this instruction at the top of your code. I have also increased the distance between the two rank levels so that there is more space for the edge labels. I have also changed the weights you had given to the edges in order to have a matrix like appearance.
Two more things I would recommend:
- rather than the HTML-like syntax for the node, use the standard graphviz format; matter of taste, but I find it easier to read and it is more flexible, see (How shall escape `>` in an edge label?),
- when creating edges from nodes lower in the hierarchy to higher ones, don't use
b->a
, rather writea->b[dir="back"]
; this avoids graphviz getting confused when the number of nodes increases
I have not completely edited the file, as it is not strictly necessary for the two items just mentioned - here the job I have done:
digraph G {
# layout
ranksep = 2
{ rank = same; file_in stdin_in string_in }
{ rank = same; file_out stdout_out variable_out }
/* directly betw inputs */
node [color=black]
string_in -> stdin_in [label="redirection"];
file_in -> stdin_in [label="redirection"];
stdin_in -> file_in [label="device file /dev/stdin, or arg -"]
stdin_in -> string_in [label="xargs"];
/* directly betw outputs */
node [color=red]
edge [color=red]
stdout_out -> file_out [label=<<font color="red">redirection</font>>];
file_out -> stdout_out [label=<<font color="red">/dev/stdout or arg -</font>>];
/* directly from input to output */
edge [color=blue]
stdin_in -> stdout_out [label=<<font color="blue">cat or tee</font>> weight = 10];
# stdin_in -> file_out [label=<<font color="blue">tee /dev/null</font>>];
stdin_in -> file_out[ label = "tee > /dev/null" fontcolor = "blue" ];
string_in -> stdout_out [label=<<font color="blue">echo -n</font>> ];
file_in -> stdout_out [label=<<font color="blue">cat</font>> ];
file_in -> file_out [label = "none" fontcolor = "blue" weight = 10];
string_in -> variable_out [label = "assignment" fontcolor = "blue" weight = 10 ];
/* directly from output to input */
edge [color=green]
stdout_out -> stdin_in [label=<<font color="green">pipe</font>>];
stdout_out -> file_in [label=<<font color="green">process substitution</font>>];
stdout_out -> string_in [label=<<font color="green">command substitution</font>>];
file_in -> file_out [label="none" fontcolor="green" dir = back ];
variable_out -> string_in [label=<<font color="green">parameter expansion</font>>];
}
which gives you
The key point here is using rank = same
; I have added this instruction at the top of your code. I have also increased the distance between the two rank levels so that there is more space for the edge labels. I have also changed the weights you had given to the edges in order to have a matrix like appearance.
Two more things I would recommend:
- rather than the HTML-like syntax for the node, use the standard graphviz format; matter of taste, but I find it easier to read and it is more flexible, see (How shall escape `>` in an edge label?),
- when creating edges from nodes lower in the hierarchy to higher ones, don't use
b->a
, rather writea->b[dir="back"]
; this avoids graphviz getting confused when the number of nodes increases
I have not completely edited the file, as it is not strictly necessary for the two items just mentioned - here the job I have done:
digraph G {
# layout
ranksep = 2
{ rank = same; file_in stdin_in string_in }
{ rank = same; file_out stdout_out variable_out }
/* directly betw inputs */
node [color=black]
string_in -> stdin_in [label="redirection"];
file_in -> stdin_in [label="redirection"];
stdin_in -> file_in [label="device file /dev/stdin, or arg -"]
stdin_in -> string_in [label="xargs"];
/* directly betw outputs */
node [color=red]
edge [color=red]
stdout_out -> file_out [label=<<font color="red">redirection</font>>];
file_out -> stdout_out [label=<<font color="red">/dev/stdout or arg -</font>>];
/* directly from input to output */
edge [color=blue]
stdin_in -> stdout_out [label=<<font color="blue">cat or tee</font>> weight = 10];
# stdin_in -> file_out [label=<<font color="blue">tee /dev/null</font>>];
stdin_in -> file_out[ label = "tee > /dev/null" fontcolor = "blue" ];
string_in -> stdout_out [label=<<font color="blue">echo -n</font>> ];
file_in -> stdout_out [label=<<font color="blue">cat</font>> ];
file_in -> file_out [label = "none" fontcolor = "blue" weight = 10];
string_in -> variable_out [label = "assignment" fontcolor = "blue" weight = 10 ];
/* directly from output to input */
edge [color=green]
stdout_out -> stdin_in [label=<<font color="green">pipe</font>>];
stdout_out -> file_in [label=<<font color="green">process substitution</font>>];
stdout_out -> string_in [label=<<font color="green">command substitution</font>>];
file_in -> file_out [label="none" fontcolor="green" dir = back ];
variable_out -> string_in [label=<<font color="green">parameter expansion</font>>];
}
which gives you
answered Nov 22 at 0:52
vaettchen
4,9751332
4,9751332
Thank you so much! :) If I may ask, (1) Is it correct thatrank
is used for ensuring the nodes with the same rank are always in the same row? (2) Is there no similar way to ensure nodes always in the same column, and the only way is by adjusting edge weights? (3) "when creating edges from nodes lower in the hierarchy to higher ones, don't use b->a, rather write a->b[dir="back"]; this avoids graphviz getting confused when the number of nodes increases". What kind of confusion is it? Thanks
– Ben
Nov 22 at 1:33
1
To your questions: (1) in principle yes,graphviz
needs to betoldwhat you wnat to haveon the same level - (2) There are other ways but depends upon the context - (3)b->a
tellsgraphviz
thatb
is hierarchically abovea
whixh may be contrary to what you want; in most cases, the context will rectify this but I have had situations where one edge in the wrong direction completely messed up the graph; as "good practice" keep the hierarchicalorder and the direction of the arrow separate
– vaettchen
Nov 22 at 15:08
Thanks. To ensure nodes always in the same column, "there are other ways but depends upon the context". If I may ask, what are some other ways commonly used? Is there no way likerank
which can enforce that?
– Ben
Nov 22 at 15:21
1
Sorry but thi is really not so easy. Just a few items to check: Make sure you declare your nodes in the right order -graphviz
draws them as they are declared. Quite often, invisible edges help to maintain order. Subgraphs can be a kind of last resort. But "no size fits all".
– vaettchen
Nov 22 at 15:31
Thanks. Just in case as a backup plan, I am also trying to figure out a way to manually adjust the SVG file originally created by GraphViz, in Inkscape or similar software. If you happen to know something about that, I'd appreciate your consideration too: unix.stackexchange.com/questions/483314/…
– Ben
Nov 22 at 16:01
add a comment |
Thank you so much! :) If I may ask, (1) Is it correct thatrank
is used for ensuring the nodes with the same rank are always in the same row? (2) Is there no similar way to ensure nodes always in the same column, and the only way is by adjusting edge weights? (3) "when creating edges from nodes lower in the hierarchy to higher ones, don't use b->a, rather write a->b[dir="back"]; this avoids graphviz getting confused when the number of nodes increases". What kind of confusion is it? Thanks
– Ben
Nov 22 at 1:33
1
To your questions: (1) in principle yes,graphviz
needs to betoldwhat you wnat to haveon the same level - (2) There are other ways but depends upon the context - (3)b->a
tellsgraphviz
thatb
is hierarchically abovea
whixh may be contrary to what you want; in most cases, the context will rectify this but I have had situations where one edge in the wrong direction completely messed up the graph; as "good practice" keep the hierarchicalorder and the direction of the arrow separate
– vaettchen
Nov 22 at 15:08
Thanks. To ensure nodes always in the same column, "there are other ways but depends upon the context". If I may ask, what are some other ways commonly used? Is there no way likerank
which can enforce that?
– Ben
Nov 22 at 15:21
1
Sorry but thi is really not so easy. Just a few items to check: Make sure you declare your nodes in the right order -graphviz
draws them as they are declared. Quite often, invisible edges help to maintain order. Subgraphs can be a kind of last resort. But "no size fits all".
– vaettchen
Nov 22 at 15:31
Thanks. Just in case as a backup plan, I am also trying to figure out a way to manually adjust the SVG file originally created by GraphViz, in Inkscape or similar software. If you happen to know something about that, I'd appreciate your consideration too: unix.stackexchange.com/questions/483314/…
– Ben
Nov 22 at 16:01
Thank you so much! :) If I may ask, (1) Is it correct that
rank
is used for ensuring the nodes with the same rank are always in the same row? (2) Is there no similar way to ensure nodes always in the same column, and the only way is by adjusting edge weights? (3) "when creating edges from nodes lower in the hierarchy to higher ones, don't use b->a, rather write a->b[dir="back"]; this avoids graphviz getting confused when the number of nodes increases". What kind of confusion is it? Thanks– Ben
Nov 22 at 1:33
Thank you so much! :) If I may ask, (1) Is it correct that
rank
is used for ensuring the nodes with the same rank are always in the same row? (2) Is there no similar way to ensure nodes always in the same column, and the only way is by adjusting edge weights? (3) "when creating edges from nodes lower in the hierarchy to higher ones, don't use b->a, rather write a->b[dir="back"]; this avoids graphviz getting confused when the number of nodes increases". What kind of confusion is it? Thanks– Ben
Nov 22 at 1:33
1
1
To your questions: (1) in principle yes,
graphviz
needs to betoldwhat you wnat to haveon the same level - (2) There are other ways but depends upon the context - (3) b->a
tells graphviz
that b
is hierarchically above a
whixh may be contrary to what you want; in most cases, the context will rectify this but I have had situations where one edge in the wrong direction completely messed up the graph; as "good practice" keep the hierarchicalorder and the direction of the arrow separate– vaettchen
Nov 22 at 15:08
To your questions: (1) in principle yes,
graphviz
needs to betoldwhat you wnat to haveon the same level - (2) There are other ways but depends upon the context - (3) b->a
tells graphviz
that b
is hierarchically above a
whixh may be contrary to what you want; in most cases, the context will rectify this but I have had situations where one edge in the wrong direction completely messed up the graph; as "good practice" keep the hierarchicalorder and the direction of the arrow separate– vaettchen
Nov 22 at 15:08
Thanks. To ensure nodes always in the same column, "there are other ways but depends upon the context". If I may ask, what are some other ways commonly used? Is there no way like
rank
which can enforce that?– Ben
Nov 22 at 15:21
Thanks. To ensure nodes always in the same column, "there are other ways but depends upon the context". If I may ask, what are some other ways commonly used? Is there no way like
rank
which can enforce that?– Ben
Nov 22 at 15:21
1
1
Sorry but thi is really not so easy. Just a few items to check: Make sure you declare your nodes in the right order -
graphviz
draws them as they are declared. Quite often, invisible edges help to maintain order. Subgraphs can be a kind of last resort. But "no size fits all".– vaettchen
Nov 22 at 15:31
Sorry but thi is really not so easy. Just a few items to check: Make sure you declare your nodes in the right order -
graphviz
draws them as they are declared. Quite often, invisible edges help to maintain order. Subgraphs can be a kind of last resort. But "no size fits all".– vaettchen
Nov 22 at 15:31
Thanks. Just in case as a backup plan, I am also trying to figure out a way to manually adjust the SVG file originally created by GraphViz, in Inkscape or similar software. If you happen to know something about that, I'd appreciate your consideration too: unix.stackexchange.com/questions/483314/…
– Ben
Nov 22 at 16:01
Thanks. Just in case as a backup plan, I am also trying to figure out a way to manually adjust the SVG file originally created by GraphViz, in Inkscape or similar software. If you happen to know something about that, I'd appreciate your consideration too: unix.stackexchange.com/questions/483314/…
– Ben
Nov 22 at 16:01
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53421930%2fhow-can-i-adjust-the-nodes-in-this-dot-program-into-a-2-by-3-table%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown