{"id":15054,"date":"2022-04-16T21:34:19","date_gmt":"2022-04-16T20:34:19","guid":{"rendered":"https:\/\/complex-systems-ai.com\/?page_id=15054"},"modified":"2022-11-28T00:06:46","modified_gmt":"2022-11-27T23:06:46","slug":"parcours-de-graphes","status":"publish","type":"page","link":"https:\/\/complex-systems-ai.com\/en\/graph-theory-2\/traversal-of-graphs\/","title":{"rendered":"Graph Journey"},"content":{"rendered":"<div data-elementor-type=\"wp-page\" data-elementor-id=\"15054\" class=\"elementor elementor-15054\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-120eb0e elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"120eb0e\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-33 elementor-top-column elementor-element elementor-element-4ffb8a6\" data-id=\"4ffb8a6\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-0e4e044 elementor-align-justify elementor-widget elementor-widget-button\" data-id=\"0e4e044\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"button.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<div class=\"elementor-button-wrapper\">\n\t\t\t\t\t<a class=\"elementor-button elementor-button-link elementor-size-sm\" href=\"https:\/\/complex-systems-ai.com\/en\/graph-theory-2\/\">\n\t\t\t\t\t\t<span class=\"elementor-button-content-wrapper\">\n\t\t\t\t\t\t\t\t\t<span class=\"elementor-button-text\">Graph Theory<\/span>\n\t\t\t\t\t<\/span>\n\t\t\t\t\t<\/a>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"elementor-column elementor-col-33 elementor-top-column elementor-element elementor-element-b608c9d\" data-id=\"b608c9d\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-1cd3944 elementor-align-justify elementor-widget elementor-widget-button\" data-id=\"1cd3944\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"button.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<div class=\"elementor-button-wrapper\">\n\t\t\t\t\t<a class=\"elementor-button elementor-button-link elementor-size-sm\" href=\"https:\/\/complex-systems-ai.com\/en\/\">\n\t\t\t\t\t\t<span class=\"elementor-button-content-wrapper\">\n\t\t\t\t\t\t\t\t\t<span class=\"elementor-button-text\">Home page<\/span>\n\t\t\t\t\t<\/span>\n\t\t\t\t\t<\/a>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"elementor-column elementor-col-33 elementor-top-column elementor-element elementor-element-6150293\" data-id=\"6150293\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-b9c2c7a elementor-align-justify elementor-widget elementor-widget-button\" data-id=\"b9c2c7a\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"button.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<div class=\"elementor-button-wrapper\">\n\t\t\t\t\t<a class=\"elementor-button elementor-button-link elementor-size-sm\" href=\"https:\/\/en.wikipedia.org\/wiki\/Depth-first_search\" target=\"_blank\" rel=\"noopener\">\n\t\t\t\t\t\t<span class=\"elementor-button-content-wrapper\">\n\t\t\t\t\t\t\t\t\t<span class=\"elementor-button-text\">Wiki<\/span>\n\t\t\t\t\t<\/span>\n\t\t\t\t\t<\/a>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-4d1cf90 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"4d1cf90\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-ac29052\" data-id=\"ac29052\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-cd2af25 elementor-widget elementor-widget-text-editor\" data-id=\"cd2af25\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>To search in a <a href=\"https:\/\/complex-systems-ai.com\/en\/graph-theory-2\/\">graph<\/a> (path of Graphs), we first build a <a href=\"https:\/\/complex-systems-ai.com\/en\/graph-theory-2\/trees-and-trees\/\">tree<\/a> covering the graph.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-48434c8 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"48434c8\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-bdb0a26\" data-id=\"bdb0a26\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-6e269f3 elementor-widget elementor-widget-heading\" data-id=\"6e269f3\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewbox=\"0 0 24 24\" version=\"1.2\" baseprofile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/complex-systems-ai.com\/en\/graph-theory-2\/traversal-of-graphs\/#Parcours-de-Graphes-et-Parcours-dArbres\" >Graph Parses and Tree Parses<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/complex-systems-ai.com\/en\/graph-theory-2\/traversal-of-graphs\/#Breadth-first-search-Recherche-en-profondeur\" >Breadth-first search \/ Deep search<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/complex-systems-ai.com\/en\/graph-theory-2\/traversal-of-graphs\/#In-depth-search-pre-order\" >In-depth search: pre-order<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/complex-systems-ai.com\/en\/graph-theory-2\/traversal-of-graphs\/#In-depth-search-in-order\" >In-depth search: in-order<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/complex-systems-ai.com\/en\/graph-theory-2\/traversal-of-graphs\/#In-depth-search-out-order\" >In-depth search: out-order<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"elementor-heading-title elementor-size-default\"><span class=\"ez-toc-section\" id=\"Parcours-de-Graphes-et-Parcours-dArbres\"><\/span>Graph Parses and Tree Parses<span class=\"ez-toc-section-end\"><\/span><\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-2f59f20 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"2f59f20\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-1e43650\" data-id=\"1e43650\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-b1048f0 elementor-widget elementor-widget-text-editor\" data-id=\"b1048f0\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h2><span class=\"ez-toc-section\" id=\"Breadth-first-search-Recherche-en-profondeur\"><\/span>Breadth-first search \/ Deep search<span class=\"ez-toc-section-end\"><\/span><\/h2><p>BFS traverses the tree increasing the depth to the root.<\/p><div class=\"wp-block-image\"><figure class=\"aligncenter\"><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter wp-image-2574 size-full\" title=\"Searching In A Tree (Data Structure) 1\" src=\"https:\/\/complex-systems-ai.com\/wp-content\/uploads\/2016\/02\/arbre5.png\" alt=\"Breadth first search Breadth of Graphs\" width=\"291\" height=\"189\" \/><\/figure><\/div><div><pre><b>BFS<\/b>(Graph G, Node s): {f = CreateQueue (); f.stack (s); mark (s);\n  <strong>while<\/strong> no f.empty () s = f.pop (); print (s);\n     <strong> for<\/strong> each children t of s in G\n           <strong>yew<\/strong> t unmarked DO f.stack (t); mark (t);\n           <strong>end if<\/strong>\n     <strong> end for<\/strong>\n  <strong>end while<\/strong>       \n }<\/pre><\/div><h2><span class=\"ez-toc-section\" id=\"In-depth-search-pre-order\"><\/span><span id=\"In-depth-search-pre-order\" class=\"ez-toc-section\"><\/span>In-depth search: pre-order<span class=\"ez-toc-section-end\"><\/span><\/h2><p>In-depth algorithms are recursive. In the prefix path, we always traverse the left subtree before processing the right subtree.<\/p><div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" class=\"aligncenter wp-image-2579 size-full\" title=\"Searching In A Tree (Data Structure) 2\" src=\"https:\/\/i0.wp.com\/complex-systems-ai.com\/wp-content\/uploads\/2016\/02\/arbre6.png?resize=198%2C187\" alt=\"In-depth search: pre-order\" width=\"198\" height=\"187\" data-recalc-dims=\"1\" \/><\/figure><\/div><div><ol><li>Check if the current node is empty or null.<\/li><li>Displays the data portion of the root (or current node).<\/li><li>Traverse the left subtree by recursively calling the preorder function.<\/li><li>Traverse the right subtree by recursively calling the preorder function.<\/li><\/ol><\/div><h2><span class=\"ez-toc-section\" id=\"In-depth-search-in-order\"><\/span><span id=\"In-depth-search-in-order\" class=\"ez-toc-section\"><\/span>In-depth search: in-order<span class=\"ez-toc-section-end\"><\/span><\/h2><p>The LNR traverses as far left as possible, and displays branches from left to right. This <a href=\"https:\/\/complex-systems-ai.com\/en\/algorithmic\/\">algorithm<\/a> displays diagonals from bottom to top.<\/p><div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" class=\"aligncenter wp-image-2585 size-full\" title=\"Searching In A Tree (Data Structure) 3\" src=\"https:\/\/i0.wp.com\/complex-systems-ai.com\/wp-content\/uploads\/2016\/02\/arbre7.png?resize=193%2C196\" alt=\"In-depth search: in-order\" width=\"193\" height=\"196\" data-recalc-dims=\"1\" \/><\/figure><\/div><div><ol><li>Check if the current node is empty or null.<\/li><li>Traverse the left subtree by recursively calling the in-order function.<\/li><li>Displays the data portion of the root (or current node).<\/li><li>Traverse the right subtree by recursively calling the in-order function.<\/li><\/ol><\/div><h2><span class=\"ez-toc-section\" id=\"In-depth-search-out-order\"><\/span><span id=\"In-depth-search-out-order\" class=\"ez-toc-section\"><\/span>In-depth search: out-order<span class=\"ez-toc-section-end\"><\/span><\/h2><p>It is a diagonal navigation from top to bottom.<\/p><div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-2592 size-full\" title=\"Searching In A Tree (Data Structure) 4\" src=\"https:\/\/i0.wp.com\/complex-systems-ai.com\/wp-content\/uploads\/2016\/02\/arbre8.png?resize=209%2C190\" alt=\"In-depth search: out-order\" width=\"209\" height=\"190\" data-recalc-dims=\"1\" \/><\/figure><\/div><div><ol><li>Check if the current node is empty or null.<\/li><li>Traverse the left subtree by recursively calling the post-order function.<\/li><li>Traverse the right subtree by recursively calling the post-order function.<\/li><li>Displays the data portion of the root (or current node).<\/li><\/ol><\/div>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>","protected":false},"excerpt":{"rendered":"<p>Graph Theory Wiki homepage To search in a graph (traverse of Graphs), we first build a tree covering the graph. Course of Graphs \u2026 <\/p>","protected":false},"author":1,"featured_media":0,"parent":2204,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-15054","page","type-page","status-publish","hentry"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/complex-systems-ai.com\/en\/wp-json\/wp\/v2\/pages\/15054","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/complex-systems-ai.com\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/complex-systems-ai.com\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/complex-systems-ai.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/complex-systems-ai.com\/en\/wp-json\/wp\/v2\/comments?post=15054"}],"version-history":[{"count":4,"href":"https:\/\/complex-systems-ai.com\/en\/wp-json\/wp\/v2\/pages\/15054\/revisions"}],"predecessor-version":[{"id":17960,"href":"https:\/\/complex-systems-ai.com\/en\/wp-json\/wp\/v2\/pages\/15054\/revisions\/17960"}],"up":[{"embeddable":true,"href":"https:\/\/complex-systems-ai.com\/en\/wp-json\/wp\/v2\/pages\/2204"}],"wp:attachment":[{"href":"https:\/\/complex-systems-ai.com\/en\/wp-json\/wp\/v2\/media?parent=15054"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}