Drawing Hypergraph using TikZ

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
5
down vote

favorite












I want to draw a Hypergraph using TikZ that looks like this



Connection Hypergraph



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


LaTeX Hypergraph



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.










share|improve this question







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 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














up vote
5
down vote

favorite












I want to draw a Hypergraph using TikZ that looks like this



Connection Hypergraph



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


LaTeX Hypergraph



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.










share|improve this question







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 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












up vote
5
down vote

favorite









up vote
5
down vote

favorite











I want to draw a Hypergraph using TikZ that looks like this



Connection Hypergraph



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


LaTeX Hypergraph



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.










share|improve this question







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



Connection Hypergraph



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


LaTeX Hypergraph



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






share|improve this question







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.











share|improve this question







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.









share|improve this question




share|improve this question






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 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
















  • 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















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










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.



enter image description here



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





share|improve this answer




















  • 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










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',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);






ncw is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















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






























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.



enter image description here



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





share|improve this answer




















  • 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














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.



enter image description here



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





share|improve this answer




















  • 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












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.



enter image description here



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





share|improve this answer












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.



enter image description here



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






share|improve this answer












share|improve this answer



share|improve this answer










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
















  • 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










ncw is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















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.













 


draft saved


draft discarded














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













































































Comments

Popular posts from this blog

White Anglo-Saxon Protestant

Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

One-line joke