{"id":255,"date":"2025-06-03T15:54:31","date_gmt":"2025-06-03T10:24:31","guid":{"rendered":"https:\/\/codeanddebug.in\/blog\/?p=255"},"modified":"2025-06-03T15:54:32","modified_gmt":"2025-06-03T10:24:32","slug":"detect-cycle-in-a-directed-graph","status":"publish","type":"post","link":"https:\/\/codeanddebug.in\/blog\/detect-cycle-in-a-directed-graph\/","title":{"rendered":"Detect Cycle in a Directed Graph"},"content":{"rendered":"\n<p>See how to solve &#8220;detect cycle in a directed graph&#8221; using depth-first search and two helper arrays. Simple idea, commented Python code, dry run, and Big-O analysis.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What does the problem ask?<\/h2>\n\n\n\n<p>You are given a directed graph with <code>V<\/code> vertices (<code>0 \u2026 V-1<\/code>) and a list of edges.<br>Return <strong><code>True<\/code><\/strong> if the graph contains <strong>at least one directed cycle<\/strong>; otherwise return <strong><code>False<\/code><\/strong>. <a href=\"https:\/\/www.geeksforgeeks.org\/problems\/detect-cycle-in-a-directed-graph\/1?utm_source=chatgpt.com\" target=\"_blank\" rel=\"noreferrer noopener\">geeksforgeeks.org<\/a><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Examples<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th><code>V<\/code><\/th><th><code>edges<\/code><\/th><th>Result<\/th><th>Why<\/th><\/tr><\/thead><tbody><tr><td><code>4<\/code><\/td><td><code>[(0,1),(1,2),(2,0),(2,3)]<\/code><\/td><td><strong>True<\/strong><\/td><td>0 \u2192 1 \u2192 2 \u2192 0 forms a cycle<\/td><\/tr><tr><td><code>3<\/code><\/td><td><code>[(0,1),(1,2)]<\/code><\/td><td><strong>False<\/strong><\/td><td>No path returns to an earlier node<\/td><\/tr><tr><td><code>1<\/code><\/td><td><code>[(0,0)]<\/code><\/td><td><strong>True<\/strong><\/td><td>Self-loop is a cycle<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Intuition &amp; Approach<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Key idea<\/h3>\n\n\n\n<p>While doing DFS, a <strong>back edge<\/strong> (an edge to a node already in the current recursion path) means a cycle.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How we detect that<\/h3>\n\n\n\n<p>We keep two arrays:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>visited[]<\/code><\/strong> \u2013 1 if the node has been processed completely.<\/li>\n\n\n\n<li><strong><code>path_visited[]<\/code><\/strong> \u2013 1 if the node is <em>in<\/em> the current DFS path (the \u201cgray\u201d state).<\/li>\n<\/ul>\n\n\n\n<p>Steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Start DFS from every unvisited node (graph may be disconnected).<\/li>\n\n\n\n<li>When we enter a node, mark both <code>visited<\/code> and <code>path_visited<\/code>.<\/li>\n\n\n\n<li>For every neighbor:\n<ul class=\"wp-block-list\">\n<li>If neighbor is unvisited \u2192 DFS deeper.<\/li>\n\n\n\n<li>If neighbor is already in <code>path_visited<\/code> \u2192 we met a gray node \u2192 <strong>cycle found<\/strong>.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>When we leave the node, clear its <code>path_visited<\/code> flag (turn it \u201cblack\u201d).<\/li>\n\n\n\n<li>If no back edge seen in any component, the graph is acyclic.<\/li>\n<\/ol>\n\n\n\n<p>This is the classic \u201cwhite-gray-black\u201d DFS cycle test.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Code<\/h2>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"class Solution:\n    # DFS that returns True as soon as a cycle is detected\n    def dfs(self, current_node, visited, path_visited, adj_list):\n        visited[current_node] = 1         # mark as visited (gray \u2192 black later)\n        path_visited[current_node] = 1    # mark as part of current path (gray)\n\n        for adjNode in adj_list[current_node]:      # explore all outgoing edges\n            if visited[adjNode] == 0:               # white node\n                x = self.dfs(adjNode, visited, path_visited, adj_list)\n                if x == True:                       # cycle found deeper\n                    return True\n            elif path_visited[adjNode] == 1:        # edge to gray node \u2192 cycle\n                return True\n\n        path_visited[current_node] = 0    # leave path (node becomes black)\n        return False\n\n    def isCycle(self, V, edges):\n        # build adjacency list\n        adj_list = [[] for _ in range(V)]\n        for u, v in edges:                # edge u \u2192 v\n            adj_list[u].append(v)\n\n        visited = [0] * V                 # 0 = white (not visited at all)\n        path_visited = [0] * V            # 0 = not in current DFS call stack\n\n        for i in range(V):                # handle all components\n            if visited[i] == 0:\n                ans = self.dfs(i, visited, path_visited, adj_list)\n                if ans == True:\n                    return True           # cycle exists\n        return False                      # no cycles anywhere\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">class<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">Solution<\/span><span style=\"color: #D4D4D4\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #6A9955\"># DFS that returns True as soon as a cycle is detected<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #569CD6\">def<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">dfs<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">self<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #9CDCFE\">current_node<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #9CDCFE\">visited<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #9CDCFE\">path_visited<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #9CDCFE\">adj_list<\/span><span style=\"color: #D4D4D4\">):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        visited[current_node] = <\/span><span style=\"color: #B5CEA8\">1<\/span><span style=\"color: #D4D4D4\">         <\/span><span style=\"color: #6A9955\"># mark as visited (gray \u2192 black later)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        path_visited[current_node] = <\/span><span style=\"color: #B5CEA8\">1<\/span><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #6A9955\"># mark as part of current path (gray)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #C586C0\">for<\/span><span style=\"color: #D4D4D4\"> adjNode <\/span><span style=\"color: #C586C0\">in<\/span><span style=\"color: #D4D4D4\"> adj_list[current_node]:      <\/span><span style=\"color: #6A9955\"># explore all outgoing edges<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            <\/span><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\"> visited[adjNode] == <\/span><span style=\"color: #B5CEA8\">0<\/span><span style=\"color: #D4D4D4\">:               <\/span><span style=\"color: #6A9955\"># white node<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">                x = <\/span><span style=\"color: #569CD6\">self<\/span><span style=\"color: #D4D4D4\">.dfs(adjNode, visited, path_visited, adj_list)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">                <\/span><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\"> x == <\/span><span style=\"color: #569CD6\">True<\/span><span style=\"color: #D4D4D4\">:                       <\/span><span style=\"color: #6A9955\"># cycle found deeper<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">                    <\/span><span style=\"color: #C586C0\">return<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">True<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            <\/span><span style=\"color: #C586C0\">elif<\/span><span style=\"color: #D4D4D4\"> path_visited[adjNode] == <\/span><span style=\"color: #B5CEA8\">1<\/span><span style=\"color: #D4D4D4\">:        <\/span><span style=\"color: #6A9955\"># edge to gray node \u2192 cycle<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">                <\/span><span style=\"color: #C586C0\">return<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">True<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        path_visited[current_node] = <\/span><span style=\"color: #B5CEA8\">0<\/span><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #6A9955\"># leave path (node becomes black)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #C586C0\">return<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">False<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #569CD6\">def<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">isCycle<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">self<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #9CDCFE\">V<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #9CDCFE\">edges<\/span><span style=\"color: #D4D4D4\">):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #6A9955\"># build adjacency list<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        adj_list = [[] <\/span><span style=\"color: #C586C0\">for<\/span><span style=\"color: #D4D4D4\"> _ <\/span><span style=\"color: #C586C0\">in<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">range<\/span><span style=\"color: #D4D4D4\">(V)]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #C586C0\">for<\/span><span style=\"color: #D4D4D4\"> u, v <\/span><span style=\"color: #C586C0\">in<\/span><span style=\"color: #D4D4D4\"> edges:                <\/span><span style=\"color: #6A9955\"># edge u \u2192 v<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            adj_list[u].append(v)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        visited = [<\/span><span style=\"color: #B5CEA8\">0<\/span><span style=\"color: #D4D4D4\">] * V                 <\/span><span style=\"color: #6A9955\"># 0 = white (not visited at all)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        path_visited = [<\/span><span style=\"color: #B5CEA8\">0<\/span><span style=\"color: #D4D4D4\">] * V            <\/span><span style=\"color: #6A9955\"># 0 = not in current DFS call stack<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #C586C0\">for<\/span><span style=\"color: #D4D4D4\"> i <\/span><span style=\"color: #C586C0\">in<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">range<\/span><span style=\"color: #D4D4D4\">(V):                <\/span><span style=\"color: #6A9955\"># handle all components<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            <\/span><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\"> visited[i] == <\/span><span style=\"color: #B5CEA8\">0<\/span><span style=\"color: #D4D4D4\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">                ans = <\/span><span style=\"color: #569CD6\">self<\/span><span style=\"color: #D4D4D4\">.dfs(i, visited, path_visited, adj_list)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">                <\/span><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\"> ans == <\/span><span style=\"color: #569CD6\">True<\/span><span style=\"color: #D4D4D4\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">                    <\/span><span style=\"color: #C586C0\">return<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">True<\/span><span style=\"color: #D4D4D4\">           <\/span><span style=\"color: #6A9955\"># cycle exists<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #C586C0\">return<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">False<\/span><span style=\"color: #D4D4D4\">                      <\/span><span style=\"color: #6A9955\"># no cycles anywhere<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">5 Code walkthrough<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Adjacency list<\/strong> quickly lists every node\u2019s outgoing edges.<\/li>\n\n\n\n<li><strong><code>dfs<\/code><\/strong> marks a node gray (<code>visited=1<\/code>, <code>path_visited=1<\/code>).<\/li>\n\n\n\n<li>For each neighbor:\n<ul class=\"wp-block-list\">\n<li>If neighbor is white \u2192 recurse.<\/li>\n\n\n\n<li>If neighbor is gray (<code>path_visited=1<\/code>) \u2192 back edge found \u2192 cycle.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Once all neighbors are processed, node turns black (<code>path_visited=0<\/code>).<\/li>\n\n\n\n<li>Outer loop makes sure we check every disconnected part.<\/li>\n\n\n\n<li>First time <code>True<\/code> comes back, we exit early.<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">6 Dry run on sample with a cycle<\/h2>\n\n\n\n<p><code>V = 4<\/code>, <code>edges = [(0,1),(1,2),(2,0),(2,3)]<\/code><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Call stack<\/th><th><code>visited<\/code><\/th><th><code>path_visited<\/code><\/th><th>Note<\/th><\/tr><\/thead><tbody><tr><td><code>dfs(0)<\/code><\/td><td><code>[1,0,0,0]<\/code><\/td><td><code>[1,0,0,0]<\/code><\/td><td>node 0 gray<\/td><\/tr><tr><td>\u2192 <code>dfs(1)<\/code><\/td><td><code>[1,1,0,0]<\/code><\/td><td><code>[1,1,0,0]<\/code><\/td><td>node 1 gray<\/td><\/tr><tr><td>\u2192 <code>dfs(2)<\/code><\/td><td><code>[1,1,1,0]<\/code><\/td><td><code>[1,1,1,0]<\/code><\/td><td>node 2 gray<\/td><\/tr><tr><td>\u2192 neighbor 0 is <strong>gray<\/strong><\/td><td><\/td><td><\/td><td>back edge \u2192 return <code>True<\/code> up the stack<\/td><\/tr><tr><td>Propagate <code>True<\/code> \u2192 <code>isCycle<\/code> returns <strong>True<\/strong><\/td><td><\/td><td><\/td><td><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">7 Complexity<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Measure<\/th><th>Value<\/th><\/tr><\/thead><tbody><tr><td><strong>Time<\/strong><\/td><td><strong>O(V + E)<\/strong><\/td><\/tr><tr><td><strong>Space<\/strong><\/td><td><strong>O(V + E)<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><em>We visit every vertex and edge once; we store the graph plus two arrays of size <code>V<\/code>.<\/em><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">8 Conclusion<\/h2>\n\n\n\n<p>Using DFS with a \u201ccurrently in path\u201d marker lets us spot a back edge\u2014the reliable sign of a directed cycle. The method is linear, easy to code, and works for any directed graph.<\/p>\n\n\n\n<div class=\"wp-block-buttons is-content-justification-center is-layout-flex wp-container-core-buttons-is-layout-16018d1d wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/codeanddebug.in\/course\/master-dsa-with-leetcode\" target=\"_blank\" rel=\"noreferrer noopener\">Join our FREE Advance DSA COURSE<\/a><\/div>\n<\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><em>For any changes to the article, kindly email at <a href=\"mailto:code@codeanddebug.in\">code@codeanddebug.in<\/a> or contact us at <a href=\"tel:+91-9712928220\">+91-9712928220<\/a>.<\/em><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>See how to solve &#8220;detect cycle in a directed graph&#8221; using depth-first search and two helper arrays. Simple idea, commented Python code, dry run, and Big-O analysis. What does the problem ask? You are given a directed graph with V vertices (0 \u2026 V-1) and a list of edges.Return True if the graph contains at<\/p>\n","protected":false},"author":1,"featured_media":257,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,6],"tags":[20,17,19],"class_list":{"0":"post-255","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-data-structures-and-algorithm","8":"category-intermediate","9":"tag-dfs","10":"tag-graph","11":"tag-medium"},"featured_image_src":"https:\/\/codeanddebug.in\/blog\/wp-content\/uploads\/2025\/06\/cycle-detection-in-directed-graph-featured-image.png","author_info":{"display_name":"codeanddebug","author_link":"https:\/\/codeanddebug.in\/blog\/author\/codeanddebug\/"},"_links":{"self":[{"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/posts\/255","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/comments?post=255"}],"version-history":[{"count":1,"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/posts\/255\/revisions"}],"predecessor-version":[{"id":258,"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/posts\/255\/revisions\/258"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/media\/257"}],"wp:attachment":[{"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/media?parent=255"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/categories?post=255"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/tags?post=255"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}