{"id":159,"date":"2026-02-14T22:57:13","date_gmt":"2026-02-14T22:57:13","guid":{"rendered":"https:\/\/ffritze.de\/?p=159"},"modified":"2026-04-21T20:48:08","modified_gmt":"2026-04-21T20:48:08","slug":"traversieren-von-graphen-mit-swift-playgrounds","status":"publish","type":"post","link":"https:\/\/ffritze.de\/en\/traversieren-von-graphen-mit-swift-playgrounds\/","title":{"rendered":"Traverse graphs with Swift Playground"},"content":{"rendered":"<h3 class=\"wp-block-heading\">What is a graph?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A graph is a mathematical structure consisting of vertices (nodes) and edges that connect these vertices. Graphs can be used to represent relationships between objects, for example in social networks or traffic networks. They are a central concept in graph theory and are used in many areas of computer science and mathematics.<\/p>\n\n\n\n<!--more-->\n\n\n\n<h3 class=\"wp-block-heading\">What does it mean to traverse a graph?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To traverse a graph means to systematically visit all the vertices of the graph to gather information or perform a specific task. This can be done by various algorithms, such as depth search or width search. Traversing is crucial for applications such as finding the shortest paths or browsing networks.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">And that's exactly what you can understand with the small app for Swift Playgrounds (Mac or iPad).<\/p>\n\n\n\n\n\n<div class=\"wp-block-buttons is-layout-flex wp-container-core-buttons-is-layout-396e47c8 wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-text-align-left wp-element-button\" href=\"https:\/\/ffritze.de\/wp-content\/uploads\/2026\/02\/GraphApp.swiftpm.zip\" style=\"padding-top:0;padding-right:var(--wp--preset--spacing--30);padding-bottom:0;padding-left:var(--wp--preset--spacing--30)\" target=\"_blank\" rel=\"noreferrer noopener\">\n<div class=\"wp-block-group is-content-justification-left is-nowrap is-layout-flex wp-container-core-group-is-layout-86b32f75 wp-block-group-is-layout-flex\" style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-right:0;padding-bottom:0;padding-left:0\">\n                    <figure class=\"wp-block-image size-full\">\n                        <img loading=\"lazy\" decoding=\"async\" width=\"89\" height=\"88\" src=\"https:\/\/ffritze.de\/wp-content\/uploads\/2026\/02\/swift_48.png\" alt=\"\" class=\"wp-image-543\">\n                    <\/figure>\n\n                    <div class=\"wp-block-group has-small-font-size is-vertical is-content-justification-center is-layout-flex wp-container-core-group-is-layout-5a53e0e2 wp-block-group-is-layout-flex\" style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-right:0;padding-bottom:0;padding-left:0\">\n                        <p class=\"has-medium-font-size\">Download<\/p>\n\n                        <p class=\"has-text-align-center\">for Swift Playground<\/p>\n                    <\/div>\n                <\/div>\n<\/a><\/div>\n<\/div>\n\n\n\n\n\n<div style=\"height:33px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\" style=\"border-width:1px;border-top-left-radius:25px;border-top-right-radius:25px;border-bottom-left-radius:25px;border-bottom-right-radius:25px;box-shadow:var(--wp--preset--shadow--natural)\">\n<div class=\"wp-block-media-text has-media-on-the-right is-stacked-on-mobile\" style=\"border-style:none;border-width:0px;border-top-left-radius:0px;border-top-right-radius:0px;border-bottom-left-radius:0px;border-bottom-right-radius:0px\"><div class=\"wp-block-media-text__content\">\n<h3 class=\"wp-block-heading has-text-align-left\">Draw a graph<\/h3>\n\n\n\n<p class=\"has-text-align-left wp-block-paragraph\">New vertices are drawn by clicking anywhere in the green field. With a click on a vertex it is marked, with a click on another node an edge is drawn. The options on the buttons can also be applied to this vertex.<\/p>\n<\/div><figure class=\"wp-block-media-text__media\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"918\" src=\"https:\/\/ffritze.de\/wp-content\/uploads\/2026\/02\/graph_zeichnen-1024x918.png\" alt=\"\" class=\"wp-image-172 size-full\" srcset=\"https:\/\/ffritze.de\/wp-content\/uploads\/2026\/02\/graph_zeichnen-1024x918.png 1024w, https:\/\/ffritze.de\/wp-content\/uploads\/2026\/02\/graph_zeichnen-300x269.png 300w, https:\/\/ffritze.de\/wp-content\/uploads\/2026\/02\/graph_zeichnen-768x688.png 768w, https:\/\/ffritze.de\/wp-content\/uploads\/2026\/02\/graph_zeichnen-1536x1377.png 1536w, https:\/\/ffritze.de\/wp-content\/uploads\/2026\/02\/graph_zeichnen.png 1640w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\" style=\"border-width:1px;border-top-left-radius:25px;border-top-right-radius:25px;border-bottom-left-radius:25px;border-bottom-right-radius:25px;box-shadow:var(--wp--preset--shadow--natural)\">\n<div class=\"wp-block-media-text is-stacked-on-mobile\"><figure class=\"wp-block-media-text__media\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"918\" src=\"https:\/\/ffritze.de\/wp-content\/uploads\/2026\/02\/graph_traversieren-1024x918.png\" alt=\"\" class=\"wp-image-174 size-full\" srcset=\"https:\/\/ffritze.de\/wp-content\/uploads\/2026\/02\/graph_traversieren-1024x918.png 1024w, https:\/\/ffritze.de\/wp-content\/uploads\/2026\/02\/graph_traversieren-300x269.png 300w, https:\/\/ffritze.de\/wp-content\/uploads\/2026\/02\/graph_traversieren-768x688.png 768w, https:\/\/ffritze.de\/wp-content\/uploads\/2026\/02\/graph_traversieren-1536x1377.png 1536w, https:\/\/ffritze.de\/wp-content\/uploads\/2026\/02\/graph_traversieren.png 1640w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><div class=\"wp-block-media-text__content\">\n<h3 class=\"wp-block-heading has-text-align-right\">Traversing the graph<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">By clicking on a 'visible' vertex, it is visited (connected by an orange edge). The 'Reachable vertices' list displays all 'visible' vertices. If the list is empty, the graph has been completely traversed, or the graph is not contiguous.<\/p>\n<\/div><\/div>\n<\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Traversing the graph by width search<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Width search is an algorithm that searches nodes in a graph or tree layer by layer, starting at a starting vertex. All direct neighbors are first examined before moving on to the more distant nodes. The width search is performed in the app when the 'Reachable vertices' list is always processed from the top (the vertex to visit is always read at the top of the list).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Crossing a graph by depth search<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Depth search is an algorithm that explores a graph by going as deep as possible in one direction before returning and exploring other paths. It is often used to find paths, recognize cycles, or completely traverse structures. The deep search is performed in the app if the 'Reachable vertices' list is always processed from the bottom (the vertex to be visited is always read at the bottom of the list).<\/p>","protected":false},"excerpt":{"rendered":"<p>Was ist ein Graph? Ein Graph ist eine mathematische Struktur, die aus Knoten und Kanten besteht, die diese Knoten verbinden. Graphen k\u00f6nnen verwendet werden, um Beziehungen zwischen Objekten darzustellen, beispielsweise in sozialen Netzwerken oder Verkehrsnetzwerken. Sie sind ein zentrales Konzept in der Graphentheorie und finden Anwendung in vielen Bereichen der Informatik und Mathematik.<\/p>","protected":false},"author":2,"featured_media":160,"comment_status":"open","ping_status":"open","sticky":false,"template":"seite-thoughts-beitrag","format":"standard","meta":{"footnotes":""},"categories":[19,7,46],"tags":[13,15,14,17,18,16],"class_list":["post-159","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-algorithms","category-programs","category-swift-playground","tag-algorithmus","tag-breitensuche","tag-graph","tag-swift","tag-swift-playgrounds","tag-tiefensuche"],"_links":{"self":[{"href":"https:\/\/ffritze.de\/en\/wp-json\/wp\/v2\/posts\/159","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ffritze.de\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ffritze.de\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ffritze.de\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ffritze.de\/en\/wp-json\/wp\/v2\/comments?post=159"}],"version-history":[{"count":0,"href":"https:\/\/ffritze.de\/en\/wp-json\/wp\/v2\/posts\/159\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ffritze.de\/en\/wp-json\/wp\/v2\/media\/160"}],"wp:attachment":[{"href":"https:\/\/ffritze.de\/en\/wp-json\/wp\/v2\/media?parent=159"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ffritze.de\/en\/wp-json\/wp\/v2\/categories?post=159"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ffritze.de\/en\/wp-json\/wp\/v2\/tags?post=159"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}