graphviz overlap edges and arrows
So I was using graphviz
and wrote the following piece:
digraph MyGraph {
rankdir=TB;
size="8,5";
node [shape = circle]; 1 2 3 4 5 6 7 8 9 r
1->4
1->4
1->5
1->5
2->6
2->6
2->7
2->7
3->8
3->8
3->9
3->9
4->1
4->1
4->5
4->5
5->1
5->1
5->4
5->4
6->2
6->2
6->7
6->7
7->2
7->2
7->6
7->6
8->3
8->3
8->9
8->9
9->3
9->3
9->8
9->8
r->1
r->1
r->1
r->2
r->2
r->2
r->3
r->3
}
Output:
I don't like it that the edges overlap (meet). Is there any way to solve it automatically? if no, how to do it manually?
I was trying to use overlap = false;
but it didn't change anything.
Also, tikzpicture
could do the trick but I'm not sure how to do it.
Furthermore, I tried to search some previous thread but they asked for different things.
graphs
New contributor
add a comment |
So I was using graphviz
and wrote the following piece:
digraph MyGraph {
rankdir=TB;
size="8,5";
node [shape = circle]; 1 2 3 4 5 6 7 8 9 r
1->4
1->4
1->5
1->5
2->6
2->6
2->7
2->7
3->8
3->8
3->9
3->9
4->1
4->1
4->5
4->5
5->1
5->1
5->4
5->4
6->2
6->2
6->7
6->7
7->2
7->2
7->6
7->6
8->3
8->3
8->9
8->9
9->3
9->3
9->8
9->8
r->1
r->1
r->1
r->2
r->2
r->2
r->3
r->3
}
Output:
I don't like it that the edges overlap (meet). Is there any way to solve it automatically? if no, how to do it manually?
I was trying to use overlap = false;
but it didn't change anything.
Also, tikzpicture
could do the trick but I'm not sure how to do it.
Furthermore, I tried to search some previous thread but they asked for different things.
graphs
New contributor
2
Graphviz is off-topic for this site, so I'm voting to close. You should ask on Stackoverflow instead, with the risk of getting it closed there as a duplicate of stackoverflow.com/questions/3967600/…. From that question you could try the idea of origin and end ports, I got some improvements on your example with, e.g.,2->6:w 2->6 2:sw->7:nw 2:w->7:w
.
– Marijn
5 hours ago
2
You could turn your question into a TeX question by switching gears. E.g.documentclass[tikz,border=3.14mm]{standalone} usetikzlibrary{graphs,graphdrawing} usegdlibrary{layered} begin{document} begin{tikzpicture} graph [layered layout, sibling distance=2cm, level distance=2cm, nodes={draw,circle,minimum size=1cm}] { r -> {1 -> 4 [xshift=-1cm] -> 5, 2 -> 6 -> 7 [xshift=0.5cm], 3 -> 8 -> 9 [xshift=0.5cm]}; }; end{tikzpicture} end{document}
compiled withlualatex
produces some similar graph (but not the arrows, which could be added).
– marmot
4 hours ago
add a comment |
So I was using graphviz
and wrote the following piece:
digraph MyGraph {
rankdir=TB;
size="8,5";
node [shape = circle]; 1 2 3 4 5 6 7 8 9 r
1->4
1->4
1->5
1->5
2->6
2->6
2->7
2->7
3->8
3->8
3->9
3->9
4->1
4->1
4->5
4->5
5->1
5->1
5->4
5->4
6->2
6->2
6->7
6->7
7->2
7->2
7->6
7->6
8->3
8->3
8->9
8->9
9->3
9->3
9->8
9->8
r->1
r->1
r->1
r->2
r->2
r->2
r->3
r->3
}
Output:
I don't like it that the edges overlap (meet). Is there any way to solve it automatically? if no, how to do it manually?
I was trying to use overlap = false;
but it didn't change anything.
Also, tikzpicture
could do the trick but I'm not sure how to do it.
Furthermore, I tried to search some previous thread but they asked for different things.
graphs
New contributor
So I was using graphviz
and wrote the following piece:
digraph MyGraph {
rankdir=TB;
size="8,5";
node [shape = circle]; 1 2 3 4 5 6 7 8 9 r
1->4
1->4
1->5
1->5
2->6
2->6
2->7
2->7
3->8
3->8
3->9
3->9
4->1
4->1
4->5
4->5
5->1
5->1
5->4
5->4
6->2
6->2
6->7
6->7
7->2
7->2
7->6
7->6
8->3
8->3
8->9
8->9
9->3
9->3
9->8
9->8
r->1
r->1
r->1
r->2
r->2
r->2
r->3
r->3
}
Output:
I don't like it that the edges overlap (meet). Is there any way to solve it automatically? if no, how to do it manually?
I was trying to use overlap = false;
but it didn't change anything.
Also, tikzpicture
could do the trick but I'm not sure how to do it.
Furthermore, I tried to search some previous thread but they asked for different things.
graphs
graphs
New contributor
New contributor
New contributor
asked 5 hours ago
abuka123abuka123
161
161
New contributor
New contributor
2
Graphviz is off-topic for this site, so I'm voting to close. You should ask on Stackoverflow instead, with the risk of getting it closed there as a duplicate of stackoverflow.com/questions/3967600/…. From that question you could try the idea of origin and end ports, I got some improvements on your example with, e.g.,2->6:w 2->6 2:sw->7:nw 2:w->7:w
.
– Marijn
5 hours ago
2
You could turn your question into a TeX question by switching gears. E.g.documentclass[tikz,border=3.14mm]{standalone} usetikzlibrary{graphs,graphdrawing} usegdlibrary{layered} begin{document} begin{tikzpicture} graph [layered layout, sibling distance=2cm, level distance=2cm, nodes={draw,circle,minimum size=1cm}] { r -> {1 -> 4 [xshift=-1cm] -> 5, 2 -> 6 -> 7 [xshift=0.5cm], 3 -> 8 -> 9 [xshift=0.5cm]}; }; end{tikzpicture} end{document}
compiled withlualatex
produces some similar graph (but not the arrows, which could be added).
– marmot
4 hours ago
add a comment |
2
Graphviz is off-topic for this site, so I'm voting to close. You should ask on Stackoverflow instead, with the risk of getting it closed there as a duplicate of stackoverflow.com/questions/3967600/…. From that question you could try the idea of origin and end ports, I got some improvements on your example with, e.g.,2->6:w 2->6 2:sw->7:nw 2:w->7:w
.
– Marijn
5 hours ago
2
You could turn your question into a TeX question by switching gears. E.g.documentclass[tikz,border=3.14mm]{standalone} usetikzlibrary{graphs,graphdrawing} usegdlibrary{layered} begin{document} begin{tikzpicture} graph [layered layout, sibling distance=2cm, level distance=2cm, nodes={draw,circle,minimum size=1cm}] { r -> {1 -> 4 [xshift=-1cm] -> 5, 2 -> 6 -> 7 [xshift=0.5cm], 3 -> 8 -> 9 [xshift=0.5cm]}; }; end{tikzpicture} end{document}
compiled withlualatex
produces some similar graph (but not the arrows, which could be added).
– marmot
4 hours ago
2
2
Graphviz is off-topic for this site, so I'm voting to close. You should ask on Stackoverflow instead, with the risk of getting it closed there as a duplicate of stackoverflow.com/questions/3967600/…. From that question you could try the idea of origin and end ports, I got some improvements on your example with, e.g.,
2->6:w 2->6 2:sw->7:nw 2:w->7:w
.– Marijn
5 hours ago
Graphviz is off-topic for this site, so I'm voting to close. You should ask on Stackoverflow instead, with the risk of getting it closed there as a duplicate of stackoverflow.com/questions/3967600/…. From that question you could try the idea of origin and end ports, I got some improvements on your example with, e.g.,
2->6:w 2->6 2:sw->7:nw 2:w->7:w
.– Marijn
5 hours ago
2
2
You could turn your question into a TeX question by switching gears. E.g.
documentclass[tikz,border=3.14mm]{standalone} usetikzlibrary{graphs,graphdrawing} usegdlibrary{layered} begin{document} begin{tikzpicture} graph [layered layout, sibling distance=2cm, level distance=2cm, nodes={draw,circle,minimum size=1cm}] { r -> {1 -> 4 [xshift=-1cm] -> 5, 2 -> 6 -> 7 [xshift=0.5cm], 3 -> 8 -> 9 [xshift=0.5cm]}; }; end{tikzpicture} end{document}
compiled with lualatex
produces some similar graph (but not the arrows, which could be added).– marmot
4 hours ago
You could turn your question into a TeX question by switching gears. E.g.
documentclass[tikz,border=3.14mm]{standalone} usetikzlibrary{graphs,graphdrawing} usegdlibrary{layered} begin{document} begin{tikzpicture} graph [layered layout, sibling distance=2cm, level distance=2cm, nodes={draw,circle,minimum size=1cm}] { r -> {1 -> 4 [xshift=-1cm] -> 5, 2 -> 6 -> 7 [xshift=0.5cm], 3 -> 8 -> 9 [xshift=0.5cm]}; }; end{tikzpicture} end{document}
compiled with lualatex
produces some similar graph (but not the arrows, which could be added).– marmot
4 hours ago
add a comment |
1 Answer
1
active
oldest
votes
Welcome to TeX.SE! Here is a TikZ code that produces something of this sort. Unfortunately this is not too automatic. However, it may be the basis for some deeper application of the graph drawing algorithms.
documentclass[tikz,border=3.14mm]{standalone}
usetikzlibrary{graphs,graphdrawing}
usegdlibrary{layered}
begin{document}
begin{tikzpicture}
graph [layered layout, sibling distance=3cm, level distance=2cm,
nodes={draw,circle,minimum size=1cm},edges={opacity=0}] {
r -> {1 -> 4 [xshift=-1cm] -> 5, 2 -> 6 [xshift=-0.5cm] -> 7 [xshift=0.5cm],
3 -> 8 [xshift=-0.5cm] -> 9 [xshift=0.5cm]};
};
begin{scope}[every edge/.append style={-latex}]
foreach X in {1,2,3}
{draw (r) edge[bend right=15] (X) (r) edge (X)
(r) edge[bend right=-15] (X);}
foreach X/Y in {1/4,4/5,2/6,6/7,3/8,8/9}
{draw(X) edge[bend right=10] (Y)
(X) edge[bend right=25] (Y)
(Y) edge[bend right=10] (X)
(Y) edge[bend right=25] (X);}
foreach X/Y in {1/5,2/7,3/9}
{draw
(X) edge[bend left=10] (Y)
(X) edge[bend left=20] (Y)
(Y) edge[bend right=30] (X)
(Y) edge[bend right=40] (X);}
end{scope}
end{tikzpicture}
end{document}
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
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',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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
});
}
});
abuka123 is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
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%2ftex.stackexchange.com%2fquestions%2f472496%2fgraphviz-overlap-edges-and-arrows%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
Welcome to TeX.SE! Here is a TikZ code that produces something of this sort. Unfortunately this is not too automatic. However, it may be the basis for some deeper application of the graph drawing algorithms.
documentclass[tikz,border=3.14mm]{standalone}
usetikzlibrary{graphs,graphdrawing}
usegdlibrary{layered}
begin{document}
begin{tikzpicture}
graph [layered layout, sibling distance=3cm, level distance=2cm,
nodes={draw,circle,minimum size=1cm},edges={opacity=0}] {
r -> {1 -> 4 [xshift=-1cm] -> 5, 2 -> 6 [xshift=-0.5cm] -> 7 [xshift=0.5cm],
3 -> 8 [xshift=-0.5cm] -> 9 [xshift=0.5cm]};
};
begin{scope}[every edge/.append style={-latex}]
foreach X in {1,2,3}
{draw (r) edge[bend right=15] (X) (r) edge (X)
(r) edge[bend right=-15] (X);}
foreach X/Y in {1/4,4/5,2/6,6/7,3/8,8/9}
{draw(X) edge[bend right=10] (Y)
(X) edge[bend right=25] (Y)
(Y) edge[bend right=10] (X)
(Y) edge[bend right=25] (X);}
foreach X/Y in {1/5,2/7,3/9}
{draw
(X) edge[bend left=10] (Y)
(X) edge[bend left=20] (Y)
(Y) edge[bend right=30] (X)
(Y) edge[bend right=40] (X);}
end{scope}
end{tikzpicture}
end{document}
add a comment |
Welcome to TeX.SE! Here is a TikZ code that produces something of this sort. Unfortunately this is not too automatic. However, it may be the basis for some deeper application of the graph drawing algorithms.
documentclass[tikz,border=3.14mm]{standalone}
usetikzlibrary{graphs,graphdrawing}
usegdlibrary{layered}
begin{document}
begin{tikzpicture}
graph [layered layout, sibling distance=3cm, level distance=2cm,
nodes={draw,circle,minimum size=1cm},edges={opacity=0}] {
r -> {1 -> 4 [xshift=-1cm] -> 5, 2 -> 6 [xshift=-0.5cm] -> 7 [xshift=0.5cm],
3 -> 8 [xshift=-0.5cm] -> 9 [xshift=0.5cm]};
};
begin{scope}[every edge/.append style={-latex}]
foreach X in {1,2,3}
{draw (r) edge[bend right=15] (X) (r) edge (X)
(r) edge[bend right=-15] (X);}
foreach X/Y in {1/4,4/5,2/6,6/7,3/8,8/9}
{draw(X) edge[bend right=10] (Y)
(X) edge[bend right=25] (Y)
(Y) edge[bend right=10] (X)
(Y) edge[bend right=25] (X);}
foreach X/Y in {1/5,2/7,3/9}
{draw
(X) edge[bend left=10] (Y)
(X) edge[bend left=20] (Y)
(Y) edge[bend right=30] (X)
(Y) edge[bend right=40] (X);}
end{scope}
end{tikzpicture}
end{document}
add a comment |
Welcome to TeX.SE! Here is a TikZ code that produces something of this sort. Unfortunately this is not too automatic. However, it may be the basis for some deeper application of the graph drawing algorithms.
documentclass[tikz,border=3.14mm]{standalone}
usetikzlibrary{graphs,graphdrawing}
usegdlibrary{layered}
begin{document}
begin{tikzpicture}
graph [layered layout, sibling distance=3cm, level distance=2cm,
nodes={draw,circle,minimum size=1cm},edges={opacity=0}] {
r -> {1 -> 4 [xshift=-1cm] -> 5, 2 -> 6 [xshift=-0.5cm] -> 7 [xshift=0.5cm],
3 -> 8 [xshift=-0.5cm] -> 9 [xshift=0.5cm]};
};
begin{scope}[every edge/.append style={-latex}]
foreach X in {1,2,3}
{draw (r) edge[bend right=15] (X) (r) edge (X)
(r) edge[bend right=-15] (X);}
foreach X/Y in {1/4,4/5,2/6,6/7,3/8,8/9}
{draw(X) edge[bend right=10] (Y)
(X) edge[bend right=25] (Y)
(Y) edge[bend right=10] (X)
(Y) edge[bend right=25] (X);}
foreach X/Y in {1/5,2/7,3/9}
{draw
(X) edge[bend left=10] (Y)
(X) edge[bend left=20] (Y)
(Y) edge[bend right=30] (X)
(Y) edge[bend right=40] (X);}
end{scope}
end{tikzpicture}
end{document}
Welcome to TeX.SE! Here is a TikZ code that produces something of this sort. Unfortunately this is not too automatic. However, it may be the basis for some deeper application of the graph drawing algorithms.
documentclass[tikz,border=3.14mm]{standalone}
usetikzlibrary{graphs,graphdrawing}
usegdlibrary{layered}
begin{document}
begin{tikzpicture}
graph [layered layout, sibling distance=3cm, level distance=2cm,
nodes={draw,circle,minimum size=1cm},edges={opacity=0}] {
r -> {1 -> 4 [xshift=-1cm] -> 5, 2 -> 6 [xshift=-0.5cm] -> 7 [xshift=0.5cm],
3 -> 8 [xshift=-0.5cm] -> 9 [xshift=0.5cm]};
};
begin{scope}[every edge/.append style={-latex}]
foreach X in {1,2,3}
{draw (r) edge[bend right=15] (X) (r) edge (X)
(r) edge[bend right=-15] (X);}
foreach X/Y in {1/4,4/5,2/6,6/7,3/8,8/9}
{draw(X) edge[bend right=10] (Y)
(X) edge[bend right=25] (Y)
(Y) edge[bend right=10] (X)
(Y) edge[bend right=25] (X);}
foreach X/Y in {1/5,2/7,3/9}
{draw
(X) edge[bend left=10] (Y)
(X) edge[bend left=20] (Y)
(Y) edge[bend right=30] (X)
(Y) edge[bend right=40] (X);}
end{scope}
end{tikzpicture}
end{document}
answered 3 hours ago
marmotmarmot
95.5k4110210
95.5k4110210
add a comment |
add a comment |
abuka123 is a new contributor. Be nice, and check out our Code of Conduct.
abuka123 is a new contributor. Be nice, and check out our Code of Conduct.
abuka123 is a new contributor. Be nice, and check out our Code of Conduct.
abuka123 is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- 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');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
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%2ftex.stackexchange.com%2fquestions%2f472496%2fgraphviz-overlap-edges-and-arrows%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');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
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');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
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');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
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
2
Graphviz is off-topic for this site, so I'm voting to close. You should ask on Stackoverflow instead, with the risk of getting it closed there as a duplicate of stackoverflow.com/questions/3967600/…. From that question you could try the idea of origin and end ports, I got some improvements on your example with, e.g.,
2->6:w 2->6 2:sw->7:nw 2:w->7:w
.– Marijn
5 hours ago
2
You could turn your question into a TeX question by switching gears. E.g.
documentclass[tikz,border=3.14mm]{standalone} usetikzlibrary{graphs,graphdrawing} usegdlibrary{layered} begin{document} begin{tikzpicture} graph [layered layout, sibling distance=2cm, level distance=2cm, nodes={draw,circle,minimum size=1cm}] { r -> {1 -> 4 [xshift=-1cm] -> 5, 2 -> 6 -> 7 [xshift=0.5cm], 3 -> 8 -> 9 [xshift=0.5cm]}; }; end{tikzpicture} end{document}
compiled withlualatex
produces some similar graph (but not the arrows, which could be added).– marmot
4 hours ago