[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-0-en-105":3,"doc-seo-782747-105":59,"doc-detail-782747-en":129,"doc-similar-782747":160},{"code":4,"msg":5,"data":6},0,"success",[7,13,18,23,28,33,38,43,48,51,55],{"id":8,"doc_module":4,"doc_module_name":9,"category_name":10,"show_sort_weight":11,"slug":12},1,"Document","Story & Novel",90,"story-novel",{"id":14,"doc_module":4,"doc_module_name":9,"category_name":15,"show_sort_weight":16,"slug":17},2,"Literature",80,"literature",{"id":19,"doc_module":4,"doc_module_name":9,"category_name":20,"show_sort_weight":21,"slug":22},4,"Exam",70,"exam",{"id":24,"doc_module":4,"doc_module_name":9,"category_name":25,"show_sort_weight":26,"slug":27},5,"Comic",60,"comic",{"id":29,"doc_module":4,"doc_module_name":9,"category_name":30,"show_sort_weight":31,"slug":32},6,"Technology",50,"technology",{"id":34,"doc_module":4,"doc_module_name":9,"category_name":35,"show_sort_weight":36,"slug":37},7,"Healthcare",40,"healthcare",{"id":39,"doc_module":4,"doc_module_name":9,"category_name":40,"show_sort_weight":41,"slug":42},8,"Research & Report",30,"research-report",{"id":44,"doc_module":4,"doc_module_name":9,"category_name":45,"show_sort_weight":46,"slug":47},9,"Religion & Spirituality",20,"religion-spirituality",{"id":46,"doc_module":4,"doc_module_name":9,"category_name":49,"show_sort_weight":46,"slug":50},"World Cup","world-cup",{"id":52,"doc_module":4,"doc_module_name":9,"category_name":53,"show_sort_weight":52,"slug":54},10,"Lifestyle","lifestyle",{"id":56,"doc_module":4,"doc_module_name":9,"category_name":57,"show_sort_weight":24,"slug":58},19,"General","general",{"code":4,"msg":60,"data":61},"ok",{"site_id":62,"language":63,"slug":64,"title":65,"keywords":66,"description":67,"schema_data":68,"social_meta":122,"head_meta":124,"extra_data":126,"updated_unix":128},105,"en","graphs","Graphs","","Graph decomposition presents graphs as models for computer science problems. It defines directed and undirected graphs, paths, reachability, cycles, and directed acyclic graphs. It compares adjacency matrices and adjacency lists by storage and edge lookup, using the Web as an example. Depth-first search is introduced as a linear-time way to explore reachable vertices. A maze motivates the method, while white, grey, and black states mark vertices as undiscovered, active, or finished.",{"@graph":69,"@context":121},[70,84,104],{"@type":71,"itemListElement":72},"BreadcrumbList",[73,77,79,82],{"item":74,"name":75,"@type":76,"position":8},"https://docshare.wps.com","Home","ListItem",{"item":78,"name":9,"@type":76,"position":14},"https://docshare.wps.com/document/",{"item":80,"name":30,"@type":76,"position":81},"https://docshare.wps.com/document/technology/",3,{"item":83,"name":65,"@type":76,"position":19},"https://docshare.wps.com/document/graphs/782747/",{"url":83,"name":65,"@type":85,"image":86,"author":91,"headline":65,"publisher":94,"fileFormat":97,"inLanguage":63,"description":67,"dateModified":98,"datePublished":98,"encodingFormat":97,"isAccessibleForFree":99,"interactionStatistic":100},"DigitalDocument",{"url":87,"@type":88,"width":89,"height":90},"https://docshare.wps.com/thumbnails/graphs/782747.png","ImageObject",300,407,{"name":92,"@type":93},"percent12345","Person",{"url":74,"name":95,"@type":96},"DocShare","Organization","application/pdf","2026-12-03",true,{"@type":101,"interactionType":102,"userInteractionCount":14},"InteractionCounter",{"@type":103},"ViewAction",{"@type":105,"mainEntity":106},"FAQPage",[107,113,117],{"name":108,"@type":109,"acceptedAnswer":110},"What concepts are defined in the graph section?","Question",{"text":111,"@type":112},"It defines directed and undirected graphs, paths, reachability, cycles, and directed acyclic graphs.","Answer",{"name":114,"@type":109,"acceptedAnswer":115},"How do adjacency matrices and adjacency lists differ?",{"text":116,"@type":112},"Adjacency matrices use O(|V|²) space and allow constant-time edge checks. Adjacency lists use O(|V| + |E|) space, but edge presence is not checkable in constant time.",{"name":118,"@type":109,"acceptedAnswer":119},"How does depth-first search track exploration?",{"text":120,"@type":112},"It marks vertices white when undiscovered, grey when discovered but not fully explored, and black when exploration is complete.","https://schema.org",{"og:url":83,"og:type":123,"og:title":65,"og:site_name":95,"og:description":67},"article",{"robots":125,"canonical":83},"index,follow",{"doc_id":127,"site_id":62},782747,1796313786,{"code":4,"msg":5,"data":130},{"doc_id":127,"user_id":131,"nickname":92,"user_avatar":132,"doc_module":4,"category_id":29,"category_name":30,"doc_title":65,"doc_description":67,"doc_content":133,"file_id":134,"file_url":135,"file_type":136,"file_size":137,"view_count":14,"is_deleted":4,"is_public":8,"is_downloadable":8,"audit_status":8,"page_count":138,"language":139,"language_code":63,"site_id":62,"html_lang":63,"table_of_contents":140,"faqs":141,"seo_title":142,"seo_description":67,"update_tm":128,"read_time":143,"preview_page_count":19,"preview_urls":144},1099529851338,"https://ap-avatar.wpscdn.com/davatar_155a257f0dc6eb9ab79c44ca47cae57d","Design and Analysis of Algorithms  \nPart 5  \nGraph Decomposition  \nElias Koutsoupias  \nwith thanks to Giulio Chiribella  \nHilary Term 2022  \nWhy graphs? [DPV 3.1]  \nGraphs are one of the most fundamental notions in CS: Many CS problems have an underlying graph structure.  \nExample: Colouring a map  \nProblem: what is the minimum number of colours needed so that neighbouring countries have different colours?  \nGraph formulation:  \n􀀃 One vertex for each country.  \n􀀃 Two vertices are linked by an edge if they represent neighbouring countries.  \nThe original problem can be reduced to a graph problem, known as the  \nGraph Colouring Problem:  \n􀀂nd the minimum number of colours needed to colour the vertices of the graphs so that no edge has endpoints of the same colour.  \nDAA 2021-22 5. Graph Decomposition – 2 / 33  \nA directed graph (V, E) consists of a set V of nodes (or vertices) and a set E ⊆ V × V of edges, each edge e being an ordered pair (u, v) of nodes; u is the source of e, and v is the target of e; we say that e is incident on u and v. In this case, we also say that u and v are adjacent.  \nA path of length k from a vertex u to a vertex u′ is a sequence hv0 , v 1 , ··· , v k i of vertices such that u = v0 , u′ = v k , and each  \n(vi , vi+1) ∈ E. If there is a path from u to u′, then u′ is reachable from u.  \nA path hv0 , v 1 , ··· , v k i forms a cycle if v0 = vk and the path contains at least one edge. A self-loop is a cycle of length 1 . The cycle is simple if, in addition, v 1 , ··· , vk are distinct.  \nAn acyclic directed graph (dag) is a directed graph with no cycles.  \nA graph (V, E) is undirected if E is symmetric i.e. (u, v) ∈ E iff (v, u) ∈ E.  \nTwo representations of graphs [DPV 3.1.1, CLRS 22.1]  \nA graph G = (V, E) with V = {v0 , ··· , vn−1 } can be represented by the following data structures, adjacency matrix and adjacency lists.  \nAdjacency matrix  \nn × n array whose (i, j)-th entry is  \naij = 􀀚 10 ifoth(vi,vjerwis)e∈ E  \n􀀃 Presence of an edge can be checked in constant time.  \n􀀃 Data structure has size O(|V |2 ) .  \n􀀃 For an undirected graph, the matrix is symmetric.  \nDAA 2021-22 5. Graph Decomposition – 4 / 33  \n073❅❅❅❅❅❅❅❅❅ 703❅❅❅❅❅❅❅❅❅❅ /0734  \n􀀏􀀏  ❅❅❅❅ 􀀏􀀏 ❅❅❅❅ 􀀏􀀏 073❅ /7034 0734  \n ❅❅❅    \n❅❅❅  ❅❅❅  \n ❅❅❅❅ 􀀏􀀏 􀀏􀀏  \n 7043~~o ~~~~6~~0734  \nA B C D E F G H  \nA  \nB  \nC  \nD  \nE  \nF  \nG  \nH  \n0 0  \n0 1  \n0 0  \n0 0  \n1 0  \n0 0  \n0 1  \n0 0  \n1 0  \n0 0  \n0 0  \n0 0  \n0 0  \n1 0  \n0 0  \n0 0  \n0 1  \n0 0  \n0 0  \n0 0  \n1 0  \n0 0  \n1 0  \n0 0  \n0 0  \n0 0  \n1 1  \n0 1  \n0 0  \n0 1  \n1 0  \n0 0  \nAdjacency lists  \nIt consists of |V | linked lists, one per vertex. The list for vertex u holds the names of vertices to which u has an outgoing edge.  \n􀀃 Presence of an edge is not checkable in constant time.  \n􀀃 Data structure has size O(|V | + |E|) .  \n􀀃 For an undirected graph, u is in v’s adjacency list iff v is in u’s.  \nAdjacency lists  \nIt consists of |V | linked lists, one per vertex. The list for vertex u holds the names of vertices to which u has an outgoing edge.  \n􀀃 Presence of an edge is not checkable in constant time.  \n􀀃 Data structure has size O(|V | + |E|) .  \n􀀃 For an undirected graph, u is in v’s adjacency list iff v is in u’s.  \nQuestion  \nWhich would you use to represent the World Wide Web (there is an edge between two sites if they there is a link from one to the other)?  \nExample: adjacency lists  \n704❅❅❅❅❅❅❅❅❅ 073❅❅❅❅❅❅❅❅❅❅ /0734  \n􀀏􀀏  ❅❅❅❅ 􀀏􀀏 ❅❅❅❅ 􀀏􀀏 704❅ /0734 0734  \n ❅❅❅    \n❅❅❅  ❅❅❅  \n ❅❅❅❅ 􀀏􀀏 􀀏􀀏  \n 0734~~o ~~~~6~~0734  \nVertices ABC DEF GH  \n Adj. Lists   \n[B, C, F][E]  \n[D]  \n[A, H]  \n[F, G, H]  \n[B, G][ ][G]  \nDepth-􀀂rst search (DFS) [DPV 3.2.1]  \nDFS is a versatile linear-time algorithm that answers the basic question:  \nWhat parts of the graph are reachable from a given vertex?  \nIt works for both directed and undirected graphs.  \nMotivation: Exploring a maze  \nAll one needs to explore a maze are:  \n1 . a piece of chalk (to prevent looping), and  \n2 . a ball of string (to enable return to passages enc","cbCaiirbHUc4ZXd8","https://ap.wps.com/l/cbCaiirbHUc4ZXd8","pdf",182392,35,"English","# Graphs and representations\n## Why graphs?\n## Graph definitions\n## Graph representations\n# Depth-first search\n## Overview and motivation\n## Vertex states","[{\"question\":\"What concepts are defined in the graph section?\",\"answer\":\"It defines directed and undirected graphs, paths, reachability, cycles, and directed acyclic graphs.\"},{\"question\":\"How do adjacency matrices and adjacency lists differ?\",\"answer\":\"Adjacency matrices use O(|V|²) space and allow constant-time edge checks. Adjacency lists use O(|V| + |E|) space, but edge presence is not checkable in constant time.\"},{\"question\":\"How does depth-first search track exploration?\",\"answer\":\"It marks vertices white when undiscovered, grey when discovered but not fully explored, and black when exploration is complete.\"}]","Graphs | PDF",88,[145,149,152,156],{"page_no":8,"url":146,"width":147,"height":148},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-12-03/d0c068bb120ef3c1683056195ac4def9.webp",983,736,{"page_no":14,"url":150,"width":151,"height":148},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-12-03/bf7c1b2b4baa621f611d1c7ad5bb5e1e.webp",982,{"page_no":81,"url":153,"width":154,"height":155},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-12-03/b11ea7bd3203ce00a31a925af74fd917.webp",981,735,{"page_no":19,"url":157,"width":158,"height":159},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-12-03/92b9cf3df5a318967c2eea71e1a02ccd.webp",980,734,{"list":161,"token":66},[162,168,174,180,186,193,199,206,212,218],{"doc_id":163,"doc_title":164,"file_type":136,"home_preview_img_url":165,"slug":166,"view_count":14,"category_name":30,"create_tm":167},782750,"unit5","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230055130327/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796354339&Signature=WHdL9QsgzionL%2BiEER0LGdf5WNE%3D","unit5-c2d38701924540968ffaeb66de9d2daa",1796313791,{"doc_id":169,"doc_title":170,"file_type":136,"home_preview_img_url":171,"slug":172,"view_count":14,"category_name":30,"create_tm":173},685751,"Graph Algorithms - Graph Basics - Notion of Graphs","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229999690613/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796354339&Signature=d6FmjrGK3jqB8Vg1ba6nBx%2FcVxQ%3D","graph-algorithms-graph-basics-notion-of-graphs",1794017504,{"doc_id":175,"doc_title":176,"file_type":136,"home_preview_img_url":177,"slug":178,"view_count":8,"category_name":30,"create_tm":179},685755,"Programming Workbench: Compressed Sparse Row Format for Representing Graphs","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229999690652/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796354339&Signature=KH7bPwd6Vs7Z0mZJqW68gWC1YL0%3D","programming-workbench-compressed-sparse-row-format-for-representing-graphs",1794017513,{"doc_id":181,"doc_title":182,"file_type":136,"home_preview_img_url":183,"slug":184,"view_count":39,"category_name":30,"create_tm":185},648278,"Visualization of Graphs - Lecture 8 - Hierarchical Layouts: Sugiyama Framework - Hierarchical Drawing - Motivation","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229972337116/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796354339&Signature=kK1O7QW7HzkuyhY8ZHsgS1yk%2Flc%3D","visualization-of-graphs-lecture-8-hierarchical-layouts-sugiyama-framework-hierarchical-drawing-motivation",1792792942,{"doc_id":187,"doc_title":188,"file_type":136,"home_preview_img_url":189,"slug":190,"view_count":191,"category_name":30,"create_tm":192},217203,"Markov Random Field Structure Estimator - Version 0.4.2 - Package mrfse","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229887497972/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796354339&Signature=v5xaRCd7UaCWL91pGnLDJWnFi9Y%3D","markov-random-field-structure-estimator-version-042-package-mrfse",21,1788831486,{"doc_id":194,"doc_title":195,"file_type":136,"home_preview_img_url":196,"slug":197,"view_count":46,"category_name":30,"create_tm":198},118835,"Non-Sequential Machine Learning Pipelines with pyWATTS - deRSE23-Conference","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229834985499/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796354339&Signature=qwVzzO0ghFOLLxLEXYFhSe5YuW4%3D","non-sequential-machine-learning-pipelines-with-pywatts-derse23-conference",1785720522,{"doc_id":200,"doc_title":201,"file_type":136,"home_preview_img_url":202,"slug":203,"view_count":204,"category_name":30,"create_tm":205},657698,"Using artificial intelligence to support the engineering of piping and instrumentation diagrams - modeling & prototyping","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229975664220/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796354339&Signature=JGKqQQABKZJWzQAc5n6RdLj%2FVgI%3D","using-artificial-intelligence-to-support-the-engineering-of-piping-and-instrumentation-diagrams-modeling-prototyping",13,1792986424,{"doc_id":207,"doc_title":208,"file_type":136,"home_preview_img_url":209,"slug":210,"view_count":19,"category_name":30,"create_tm":211},686585,"The Git version control system - An introduction to the Git version control system - Felix Gruber","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230001039806/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796354339&Signature=czR%2FrK5q6g4S%2FhAYJ9n1%2B0zIpRo%3D","the-git-version-control-system-an-introduction-to-the-git-version-control-system-felix-gruber",1794057221,{"doc_id":213,"doc_title":214,"file_type":136,"home_preview_img_url":215,"slug":216,"view_count":24,"category_name":30,"create_tm":217},663186,"tikz-network - Version 1.1 - User Manual","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229981599117/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796354339&Signature=CIwrr8ok%2FUKVicCI7DCcmMjM7SA%3D","tikz-network-version-11-user-manual",1793225672,{"doc_id":219,"doc_title":220,"file_type":136,"home_preview_img_url":221,"slug":222,"view_count":223,"category_name":30,"create_tm":224},655578,"UML Overview & UML Class Diagrams - Lecture Notes","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229974775249/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796354339&Signature=0IupFoC9jdoQ8lRV%2FX8YewMXK7Q%3D","uml-overview-uml-class-diagrams-lecture-notes",12,1792962714]