{"id":297,"date":"2011-09-30T23:31:51","date_gmt":"2011-09-30T23:31:51","guid":{"rendered":"http:\/\/41j.com\/blog\/?p=297"},"modified":"2016-10-02T06:00:02","modified_gmt":"2016-10-02T06:00:02","slug":"tkz-graph-example-a-latex-graph-drawing-package","status":"publish","type":"post","link":"https:\/\/41j.com\/blog\/2011\/09\/tkz-graph-example-a-latex-graph-drawing-package\/","title":{"rendered":"tkz-graph example (A latex graph drawing package)"},"content":{"rendered":"<p><a href=\"http:\/\/41j.com\/blog\/wp-content\/uploads\/2011\/09\/graph.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-298\" title=\"graph\" src=\"http:\/\/41j.com\/blog\/wp-content\/uploads\/2011\/09\/graph.png\" alt=\"\" width=\"596\" height=\"231\" srcset=\"https:\/\/41j.com\/blog\/wp-content\/uploads\/2011\/09\/graph.png 596w, https:\/\/41j.com\/blog\/wp-content\/uploads\/2011\/09\/graph-300x116.png 300w\" sizes=\"auto, (max-width: 596px) 100vw, 596px\" \/><\/a><\/p>\n<p>I recently wanted to use tkz-graph again and found the example below no longer works&#8230; here&#8217;s an updated version and a copy of the version of tkz-graph I used (old notes are below):<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n\r\n\\documentclass{article}\r\n\\usepackage{slashbox}\r\n\\usepackage{graphicx}\r\n\\usepackage&#x5B;utf8]{inputenc}\r\n\\usepackage&#x5B;usenames,dvipsnames,pdftex]{xcolor}\r\n\\usepackage{fullpage}\r\n\\usepackage{tkz-graph}\r\n%\\usepackage&#x5B;upright]{fourier}\r\n\\usepackage&#x5B;left=3cm,top=3cm,right=3cm]{geometry}\r\n\r\n\\usetikzlibrary{arrows}\r\n\\thispagestyle{empty}\r\n\\title{Graph}\r\n\\begin{document}\r\n\\maketitle\r\n\r\n\\begin{center}\r\n\\begin{tikzpicture}&#x5B;&gt;=latex']\r\n\\tikzset{node distance = 5cm}\r\n\\GraphInit&#x5B;vstyle=Normal]\r\n\\SetGraphUnit{4}\r\n\\Vertex{P}\r\n\\EA(P){A}\r\n\r\n\\tikzset{LabelStyle\/.style = {fill=white,sloped}}\r\n\\Loop&#x5B;label=$P$,dir=WE](P)\r\n\\Loop&#x5B;label=$A$,dir=EA](A)\r\n\\tikzset{EdgeStyle\/.style = {-&gt;,bend left}}\r\n\\Edge&#x5B;label=$A$](P)(A)\r\n\\Edge&#x5B;label=$P$](A)(P)\r\n\\end{tikzpicture}\r\n\\end{center}\r\n\r\n\\end{document}\r\n<\/pre>\n<p><a href=\"http:\/\/41j.com\/blog\/2011\/09\/tkz-graph-example-a-latex-graph-drawing-package\/tkz-graph\/\" rel=\"attachment wp-att-3664\">tkz-graph<\/a><br \/>\n<a href=\"http:\/\/41j.com\/blog\/2011\/09\/tkz-graph-example-a-latex-graph-drawing-package\/slashbox-sty\/\" rel=\"attachment wp-att-3665\">slashbox-sty<\/a><\/p>\n<p>The tkz-graph documentation seems very good, but it&#8217;s in french. I don&#8217;t know french. However I managed to make a little graph with loops and edge labelling. I have to say I&#8217;m pretty impressed with the results. Here&#8217;s the Latex:<\/p>\n<pre><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n\\documentclass{article}\r\n\\usepackage{slashbox}\r\n\\usepackage{graphicx}\r\n\\usepackage&#x5B;utf8]{inputenc}\r\n\\usepackage&#x5B;usenames,dvipsnames,pdftex]{xcolor}\r\n\\usepackage{fullpage}\r\n\\usepackage{tkz-graph}\r\n%\\usepackage&#x5B;upright]{fourier}\r\n\\usepackage&#x5B;left=3cm,top=3cm,right=3cm]{geometry}\r\n\r\n\\usetikzlibrary{arrows}\r\n\\thispagestyle{empty}\r\n\\title{Graph}\r\n\\begin{document}\r\n\\maketitle\r\n\r\n\\begin{center}\r\n\\begin{tikzpicture}&#x5B;&gt;=latex']\r\n  \\tikzset{node distance = 5cm}\r\n  \\GraphInit&#x5B;vstyle=Normal]\r\n  \\Vertex{0}\r\n  \\EA(0){1}\r\n\r\n  \\tikzset{LabelStyle\/.style = {fill=white,sloped}}\r\n  \\tikzset{EdgeStyle\/.style = {-&gt;,bend left}}\r\n  \\Loop&#x5B;label=$0$,dir=WE](0)\r\n  \\Loop&#x5B;label=$1$,dir=EA](1)\r\n  \\Edge&#x5B;label=$1$](0)(1)\r\n  \\Edge&#x5B;label=$0$](1)(0)\r\n\\end{tikzpicture}\r\n\\end{center}\r\n\r\n\\end{document}\r\n<\/pre>\n<p>And here's how it renders:<\/p>\n<p><a href=\"http:\/\/41j.com\/blog\/wp-content\/uploads\/2011\/09\/graph.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-298\" title=\"graph\" src=\"http:\/\/41j.com\/blog\/wp-content\/uploads\/2011\/09\/graph.png\" alt=\"\" width=\"596\" height=\"231\" srcset=\"https:\/\/41j.com\/blog\/wp-content\/uploads\/2011\/09\/graph.png 596w, https:\/\/41j.com\/blog\/wp-content\/uploads\/2011\/09\/graph-300x116.png 300w\" sizes=\"auto, (max-width: 596px) 100vw, 596px\" \/><\/a><\/p>\n<p>That's actually a De Bruijn graph for alphabet size 2, k=2 if I've done it right.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently wanted to use tkz-graph again and found the example below no longer works&#8230; here&#8217;s an updated version and a copy of the version of tkz-graph I used (old notes are below): \\documentclass{article} \\usepackage{slashbox} \\usepackage{graphicx} \\usepackage&#x5B;utf8]{inputenc} \\usepackage&#x5B;usenames,dvipsnames,pdftex]{xcolor} \\usepackage{fullpage} \\usepackage{tkz-graph} %\\usepackage&#x5B;upright]{fourier} \\usepackage&#x5B;left=3cm,top=3cm,right=3cm]{geometry} \\usetikzlibrary{arrows} \\thispagestyle{empty} \\title{Graph} \\begin{document} \\maketitle \\begin{center} \\begin{tikzpicture}&#x5B;&gt;=latex&#8217;] \\tikzset{node distance = 5cm} \\GraphInit&#x5B;vstyle=Normal] \\SetGraphUnit{4} [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[],"class_list":["post-297","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1RRoU-4N","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/297","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/comments?post=297"}],"version-history":[{"count":4,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/297\/revisions"}],"predecessor-version":[{"id":3666,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/297\/revisions\/3666"}],"wp:attachment":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/media?parent=297"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/categories?post=297"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/tags?post=297"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}