Drawing Hypergraph using TikZ

Clash Royale CLAN TAG#URR8PPP
up vote
5
down vote
favorite
I want to draw a Hypergraph using TikZ that looks like this

What I have so far:
usepackagetikz
usetikzlibrarycalc, positioning, fit, shapes.misc
begindocument
begintikzpicture
[
he/.style=draw, rounded corners, % he = hyper edge
ce/.style=draw, dashed, rounded corners % ce = condition edge
]
node (f) at (0,0) $F$;
node (g) at (1,0) $G$;
node (e) at (2,0) $E$;
node (d) at (2,1) $D$;
node (a) at (2,2) $A$;
node (b) at (3,2) $B$;
node [he, fit=(f) (g)] ;
node [ce, fit=(g) (e)] ;
node [he, fit=(a) (d) (e)] ;
node [ce, fit=(a) (b) (d)] ;
endtikzpicture
enddocument

I didn't manage to ..
- Make the hyperedges a little bit smaller like in the original picture, so that you can distinguish between hyperedges and condition edges
- Make the ABD condition edge a triangle with rounded corners
Do you have any ideas how to do this? Furthermore, this is my first time working with TikZ, so if you have any other recommendations on how to improve the way of creating this graph and how to define styles, I would be happy to learn more.
tikz-pgf tikz-styles graphs
New contributor
ncw is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
up vote
5
down vote
favorite
I want to draw a Hypergraph using TikZ that looks like this

What I have so far:
usepackagetikz
usetikzlibrarycalc, positioning, fit, shapes.misc
begindocument
begintikzpicture
[
he/.style=draw, rounded corners, % he = hyper edge
ce/.style=draw, dashed, rounded corners % ce = condition edge
]
node (f) at (0,0) $F$;
node (g) at (1,0) $G$;
node (e) at (2,0) $E$;
node (d) at (2,1) $D$;
node (a) at (2,2) $A$;
node (b) at (3,2) $B$;
node [he, fit=(f) (g)] ;
node [ce, fit=(g) (e)] ;
node [he, fit=(a) (d) (e)] ;
node [ce, fit=(a) (b) (d)] ;
endtikzpicture
enddocument

I didn't manage to ..
- Make the hyperedges a little bit smaller like in the original picture, so that you can distinguish between hyperedges and condition edges
- Make the ABD condition edge a triangle with rounded corners
Do you have any ideas how to do this? Furthermore, this is my first time working with TikZ, so if you have any other recommendations on how to improve the way of creating this graph and how to define styles, I would be happy to learn more.
tikz-pgf tikz-styles graphs
New contributor
ncw is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
you can giveinner sep=0ptin style definition ofheto make hyper edges smaller
â nidhin
1 hour ago
Thanks @nidhin. So far I tried to adjust the box sizes withscale, butinner sepworks better.
â ncw
59 mins ago
add a comment |Â
up vote
5
down vote
favorite
up vote
5
down vote
favorite
I want to draw a Hypergraph using TikZ that looks like this

What I have so far:
usepackagetikz
usetikzlibrarycalc, positioning, fit, shapes.misc
begindocument
begintikzpicture
[
he/.style=draw, rounded corners, % he = hyper edge
ce/.style=draw, dashed, rounded corners % ce = condition edge
]
node (f) at (0,0) $F$;
node (g) at (1,0) $G$;
node (e) at (2,0) $E$;
node (d) at (2,1) $D$;
node (a) at (2,2) $A$;
node (b) at (3,2) $B$;
node [he, fit=(f) (g)] ;
node [ce, fit=(g) (e)] ;
node [he, fit=(a) (d) (e)] ;
node [ce, fit=(a) (b) (d)] ;
endtikzpicture
enddocument

I didn't manage to ..
- Make the hyperedges a little bit smaller like in the original picture, so that you can distinguish between hyperedges and condition edges
- Make the ABD condition edge a triangle with rounded corners
Do you have any ideas how to do this? Furthermore, this is my first time working with TikZ, so if you have any other recommendations on how to improve the way of creating this graph and how to define styles, I would be happy to learn more.
tikz-pgf tikz-styles graphs
New contributor
ncw is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I want to draw a Hypergraph using TikZ that looks like this

What I have so far:
usepackagetikz
usetikzlibrarycalc, positioning, fit, shapes.misc
begindocument
begintikzpicture
[
he/.style=draw, rounded corners, % he = hyper edge
ce/.style=draw, dashed, rounded corners % ce = condition edge
]
node (f) at (0,0) $F$;
node (g) at (1,0) $G$;
node (e) at (2,0) $E$;
node (d) at (2,1) $D$;
node (a) at (2,2) $A$;
node (b) at (3,2) $B$;
node [he, fit=(f) (g)] ;
node [ce, fit=(g) (e)] ;
node [he, fit=(a) (d) (e)] ;
node [ce, fit=(a) (b) (d)] ;
endtikzpicture
enddocument

I didn't manage to ..
- Make the hyperedges a little bit smaller like in the original picture, so that you can distinguish between hyperedges and condition edges
- Make the ABD condition edge a triangle with rounded corners
Do you have any ideas how to do this? Furthermore, this is my first time working with TikZ, so if you have any other recommendations on how to improve the way of creating this graph and how to define styles, I would be happy to learn more.
tikz-pgf tikz-styles graphs
tikz-pgf tikz-styles graphs
New contributor
ncw is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
ncw is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
ncw is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 2 hours ago
ncw
1284
1284
New contributor
ncw is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
ncw is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
ncw is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
you can giveinner sep=0ptin style definition ofheto make hyper edges smaller
â nidhin
1 hour ago
Thanks @nidhin. So far I tried to adjust the box sizes withscale, butinner sepworks better.
â ncw
59 mins ago
add a comment |Â
you can giveinner sep=0ptin style definition ofheto make hyper edges smaller
â nidhin
1 hour ago
Thanks @nidhin. So far I tried to adjust the box sizes withscale, butinner sepworks better.
â ncw
59 mins ago
you can give
inner sep=0pt in style definition of he to make hyper edges smallerâ nidhin
1 hour ago
you can give
inner sep=0pt in style definition of he to make hyper edges smallerâ nidhin
1 hour ago
Thanks @nidhin. So far I tried to adjust the box sizes with
scale, but inner sep works better.â ncw
59 mins ago
Thanks @nidhin. So far I tried to adjust the box sizes with
scale, but inner sep works better.â ncw
59 mins ago
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
3
down vote
accepted
You can change the inner sep of hyper edge or conditional edge so that they both will have different sizes.
I don't have a good solution for the second part using fit library. I just drew that conditional edge.

documentclassarticle
usepackagetikz
usetikzlibrarycalc, positioning, fit, shapes.misc
begindocument
begintikzpicture
[
he/.style=draw, rounded corners,inner sep=0pt, % he = hyper edge
ce/.style=draw,dashed, rounded corners=10pt, % ce = condition edge
]
node (f) at (0,0) $F$;
node (g) at (1,0) $G$;
node (e) at (2,0) $E$;
node (d) at (2,1) $D$;
node (a) at (2,2) $A$;
node (b) at (3,2) $B$;
node [he, fit=(f) (g)] ;
node [ce, fit=(g) (e)] ;
node [he, fit=(a) (d) (e)] ;
node [fit=(a) (b) (d)] (fd);
draw [dashed,rounded corners=10pt] ($(fd.south west)+(0,-0.5)$) -- (fd.north west) -- ($(fd.north east)+(0.5,0)$)--cycle;
endtikzpicture
enddocument
I was just about to figure out how to draw a triangle around the nodes like you did, but I hard-coded the coordinates of the corners which is very tedious if I would ever want to add another triangle to the graph again. Your solution looks fine, thanks!
â ncw
34 mins ago
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
You can change the inner sep of hyper edge or conditional edge so that they both will have different sizes.
I don't have a good solution for the second part using fit library. I just drew that conditional edge.

documentclassarticle
usepackagetikz
usetikzlibrarycalc, positioning, fit, shapes.misc
begindocument
begintikzpicture
[
he/.style=draw, rounded corners,inner sep=0pt, % he = hyper edge
ce/.style=draw,dashed, rounded corners=10pt, % ce = condition edge
]
node (f) at (0,0) $F$;
node (g) at (1,0) $G$;
node (e) at (2,0) $E$;
node (d) at (2,1) $D$;
node (a) at (2,2) $A$;
node (b) at (3,2) $B$;
node [he, fit=(f) (g)] ;
node [ce, fit=(g) (e)] ;
node [he, fit=(a) (d) (e)] ;
node [fit=(a) (b) (d)] (fd);
draw [dashed,rounded corners=10pt] ($(fd.south west)+(0,-0.5)$) -- (fd.north west) -- ($(fd.north east)+(0.5,0)$)--cycle;
endtikzpicture
enddocument
I was just about to figure out how to draw a triangle around the nodes like you did, but I hard-coded the coordinates of the corners which is very tedious if I would ever want to add another triangle to the graph again. Your solution looks fine, thanks!
â ncw
34 mins ago
add a comment |Â
up vote
3
down vote
accepted
You can change the inner sep of hyper edge or conditional edge so that they both will have different sizes.
I don't have a good solution for the second part using fit library. I just drew that conditional edge.

documentclassarticle
usepackagetikz
usetikzlibrarycalc, positioning, fit, shapes.misc
begindocument
begintikzpicture
[
he/.style=draw, rounded corners,inner sep=0pt, % he = hyper edge
ce/.style=draw,dashed, rounded corners=10pt, % ce = condition edge
]
node (f) at (0,0) $F$;
node (g) at (1,0) $G$;
node (e) at (2,0) $E$;
node (d) at (2,1) $D$;
node (a) at (2,2) $A$;
node (b) at (3,2) $B$;
node [he, fit=(f) (g)] ;
node [ce, fit=(g) (e)] ;
node [he, fit=(a) (d) (e)] ;
node [fit=(a) (b) (d)] (fd);
draw [dashed,rounded corners=10pt] ($(fd.south west)+(0,-0.5)$) -- (fd.north west) -- ($(fd.north east)+(0.5,0)$)--cycle;
endtikzpicture
enddocument
I was just about to figure out how to draw a triangle around the nodes like you did, but I hard-coded the coordinates of the corners which is very tedious if I would ever want to add another triangle to the graph again. Your solution looks fine, thanks!
â ncw
34 mins ago
add a comment |Â
up vote
3
down vote
accepted
up vote
3
down vote
accepted
You can change the inner sep of hyper edge or conditional edge so that they both will have different sizes.
I don't have a good solution for the second part using fit library. I just drew that conditional edge.

documentclassarticle
usepackagetikz
usetikzlibrarycalc, positioning, fit, shapes.misc
begindocument
begintikzpicture
[
he/.style=draw, rounded corners,inner sep=0pt, % he = hyper edge
ce/.style=draw,dashed, rounded corners=10pt, % ce = condition edge
]
node (f) at (0,0) $F$;
node (g) at (1,0) $G$;
node (e) at (2,0) $E$;
node (d) at (2,1) $D$;
node (a) at (2,2) $A$;
node (b) at (3,2) $B$;
node [he, fit=(f) (g)] ;
node [ce, fit=(g) (e)] ;
node [he, fit=(a) (d) (e)] ;
node [fit=(a) (b) (d)] (fd);
draw [dashed,rounded corners=10pt] ($(fd.south west)+(0,-0.5)$) -- (fd.north west) -- ($(fd.north east)+(0.5,0)$)--cycle;
endtikzpicture
enddocument
You can change the inner sep of hyper edge or conditional edge so that they both will have different sizes.
I don't have a good solution for the second part using fit library. I just drew that conditional edge.

documentclassarticle
usepackagetikz
usetikzlibrarycalc, positioning, fit, shapes.misc
begindocument
begintikzpicture
[
he/.style=draw, rounded corners,inner sep=0pt, % he = hyper edge
ce/.style=draw,dashed, rounded corners=10pt, % ce = condition edge
]
node (f) at (0,0) $F$;
node (g) at (1,0) $G$;
node (e) at (2,0) $E$;
node (d) at (2,1) $D$;
node (a) at (2,2) $A$;
node (b) at (3,2) $B$;
node [he, fit=(f) (g)] ;
node [ce, fit=(g) (e)] ;
node [he, fit=(a) (d) (e)] ;
node [fit=(a) (b) (d)] (fd);
draw [dashed,rounded corners=10pt] ($(fd.south west)+(0,-0.5)$) -- (fd.north west) -- ($(fd.north east)+(0.5,0)$)--cycle;
endtikzpicture
enddocument
answered 38 mins ago
nidhin
38828
38828
I was just about to figure out how to draw a triangle around the nodes like you did, but I hard-coded the coordinates of the corners which is very tedious if I would ever want to add another triangle to the graph again. Your solution looks fine, thanks!
â ncw
34 mins ago
add a comment |Â
I was just about to figure out how to draw a triangle around the nodes like you did, but I hard-coded the coordinates of the corners which is very tedious if I would ever want to add another triangle to the graph again. Your solution looks fine, thanks!
â ncw
34 mins ago
I was just about to figure out how to draw a triangle around the nodes like you did, but I hard-coded the coordinates of the corners which is very tedious if I would ever want to add another triangle to the graph again. Your solution looks fine, thanks!
â ncw
34 mins ago
I was just about to figure out how to draw a triangle around the nodes like you did, but I hard-coded the coordinates of the corners which is very tedious if I would ever want to add another triangle to the graph again. Your solution looks fine, thanks!
â ncw
34 mins ago
add a comment |Â
ncw is a new contributor. Be nice, and check out our Code of Conduct.
ncw is a new contributor. Be nice, and check out our Code of Conduct.
ncw is a new contributor. Be nice, and check out our Code of Conduct.
ncw 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');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f457180%2fdrawing-hypergraph-using-tikz%23new-answer', 'question_page');
);
Post as a guest
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
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
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

you can give
inner sep=0ptin style definition ofheto make hyper edges smallerâ nidhin
1 hour ago
Thanks @nidhin. So far I tried to adjust the box sizes with
scale, butinner sepworks better.â ncw
59 mins ago