blog/assets/js/354a7b72.257f6430.js

1 line
68 KiB
JavaScript
Raw Normal View History

"use strict";(self.webpackChunkfi=self.webpackChunkfi||[]).push([[9414],{46617:(I,i,l)=>{l.r(i),l.d(i,{assets:()=>j,contentTitle:()=>g,default:()=>d,frontMatter:()=>a,metadata:()=>c,toc:()=>Z});var s=l(85893),m=l(11151);const a={id:"bfs-tree",title:"Distance boundaries from BFS tree on undirected graphs",description:"Short explanation of distance boundaries deduced from a BFS tree.\n",tags:["graphs","bfs"],last_update:{date:new Date("2022-04-30T00:00:00.000Z")}},g=void 0,c={id:"graphs/bfs-tree",title:"Distance boundaries from BFS tree on undirected graphs",description:"Short explanation of distance boundaries deduced from a BFS tree.\n",source:"@site/algorithms/10-graphs/2022-04-30-bfs-tree.md",sourceDirName:"10-graphs",slug:"/graphs/bfs-tree",permalink:"/algorithms/graphs/bfs-tree",draft:!1,unlisted:!1,editUrl:"https://github.com/mfocko/blog/tree/main/algorithms/10-graphs/2022-04-30-bfs-tree.md",tags:[{label:"graphs",permalink:"/algorithms/tags/graphs"},{label:"bfs",permalink:"/algorithms/tags/bfs"}],version:"current",lastUpdatedAt:1651276800,formattedLastUpdatedAt:"Apr 30, 2022",frontMatter:{id:"bfs-tree",title:"Distance boundaries from BFS tree on undirected graphs",description:"Short explanation of distance boundaries deduced from a BFS tree.\n",tags:["graphs","bfs"],last_update:{date:"2022-04-30T00:00:00.000Z"}},sidebar:"autogeneratedBar",previous:{title:"Iterative algorithms via iterators",permalink:"/algorithms/graphs/iterative-and-iterators"},next:{title:"Hash Tables",permalink:"/algorithms/category/hash-tables"}},j={},Z=[{value:"Introduction",id:"introduction",level:2},{value:"Lower bound",id:"lower-bound",level:2},{value:"Proof by contradiction",id:"proof-by-contradiction",level:2}];function n(I){const i={admonition:"admonition",annotation:"annotation",em:"em",h2:"h2",img:"img",li:"li",math:"math",mi:"mi",mn:"mn",mo:"mo",mrow:"mrow",p:"p",semantics:"semantics",span:"span",strong:"strong",ul:"ul",...(0,m.a)(),...I.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.h2,{id:"introduction",children:"Introduction"}),"\n",(0,s.jsxs)(i.p,{children:["As we have talked on the seminar, if we construct from some vertex ",(0,s.jsxs)(i.span,{className:"katex",children:[(0,s.jsx)(i.span,{className:"katex-mathml",children:(0,s.jsx)(i.math,{xmlns:"http://www.w3.org/1998/Math/MathML",children:(0,s.jsxs)(i.semantics,{children:[(0,s.jsx)(i.mrow,{children:(0,s.jsx)(i.mi,{children:"u"})}),(0,s.jsx)(i.annotation,{encoding:"application/x-tex",children:"u"})]})})}),(0,s.jsx)(i.span,{className:"katex-html","aria-hidden":"true",children:(0,s.jsxs)(i.span,{className:"base",children:[(0,s.jsx)(i.span,{className:"strut",style:{height:"0.4306em"}}),(0,s.jsx)(i.span,{className:"mord mathnormal",children:"u"})]})})]})," BFS tree on an undirected graph, we can obtain:"]}),"\n",(0,s.jsxs)(i.ul,{children:["\n",(0,s.jsxs)(i.li,{children:["lower bound of length of the shortest path between 2 vertices from the ",(0,s.jsx)(i.em,{children:"height difference"})]}),"\n",(0,s.jsxs)(i.li,{children:["upper bound of length of the shortest path between 2 vertices from the ",(0,s.jsx)(i.em,{children:"path through the root"})]}),"\n"]}),"\n",(0,s.jsx)(i.h2,{id:"lower-bound",children:"Lower bound"}),"\n",(0,s.jsx)(i.p,{children:"Consider the following graph:"}),"\n",(0,s.jsxs)(i.p,{children:[(0,s.jsx)(i.img,{src:l(79968).Z+"#gh-light-mode-only",width:"252",height:"539"}),"\n",(0,s.jsx)(i.img,{src:l(21949).Z+"#gh-dark-mode-only",width:"252",height:"539"})]}),"\n",(0,s.jsxs)(i.p,{children:["We run BFS from the vertex ",(0,s.jsxs)(i.span,{className:"katex",children:[(0,s.jsx)(i.span,{className:"katex-mathml",children:(0,s.jsx)(i.math,{xmlns:"http://www.w3.org/1998/Math/MathML",children:(0,s.jsxs)(i.semantics,{children:[(0,s.jsx)(i.mrow,{children:(0,s.jsx)(i.mi,{children:"a"})}),(0,s.jsx)(i.annotation,{encoding:"application/x-tex",children:"a"})]})})}),(0,s.jsx)(i.span,{className:"katex-html","aria-hidden":"true",children:(0,s.jsxs)(i.span,{className:"base",children:[(0,s.jsx)(i.span,{className:"strut",style:{height:"0.4306em"}}),(0,s.jsx)(i.span,{clas