{"id":2344,"date":"2018-01-22T22:12:50","date_gmt":"2018-01-23T06:12:50","guid":{"rendered":"https:\/\/blogs.ubc.ca\/cpsc3202017winter2\/?page_id=2344"},"modified":"2018-01-22T22:12:50","modified_gmt":"2018-01-23T06:12:50","slug":"tutorial-3-solutions","status":"publish","type":"page","link":"https:\/\/blogs.ubc.ca\/cpsc3202017winter2\/tutorial-3-solutions\/","title":{"rendered":"Tutorial #3 solutions"},"content":{"rendered":"<ol>\n<li>We can rewrite <i>xy<\/i> as <i>((x + y)<sup>2<\/sup> &#8211; x<sup>2<\/sup> &#8211; y<sup>2<\/sup>)\/2<\/i>, and hence compute <i>xy<\/i> using three calls to our square function, and 4 other operations.<\/li>\n<li>We construct a new graph G&#8217; = (V, E&#8217;) where E&#8217; contains every pair {x, y} of vertices of G that is NOT an edge of G (that is, every {x, y} such that {x, y} \u2209 E), and find the largest clique in G&#8217;. Because every subset W of V that is a clique in G&#8217; is an independent set in G, and every subset W of V that is an independent set in G is a clique in G&#8217;, the largest clique in G&#8217; <b>is<\/b> the largest independent set in G.<\/li>\n<li>Given G, we contruct a graph G&#8217; by adding one vertex v<sub>e<\/sub> for each edge e \u2208 E, and connecting this vertex to the endpoints of e. That is, if e = {x, y} then we add the edges {v<sub>e<\/sub>, x} and {v<sub>e<\/sub>, y}. This construction is illustrated below: the graph on top is G, and the bottom graph is G&#8217;.<br \/>\n<img decoding=\"async\" src=\"https:\/\/blogs.ubc.ca\/cpsc3202017winter2\/files\/2018\/01\/vcds.png\"><\/p>\n<p>Suppose that G has a vertex cover W with K vertices. The same K vertices will be a dominating set in G&#8217;: a vertex of G&#8217; that is not in W is either (1) a vertex from G that&#8217;s the endpoint of an edge of G, whose other endpoint must be in W, or (2) one of the new vertices v<sub>e<\/sub>, which is connected to both endpoints of the edge e of G, and hence to a member of W.<\/p>\n<p>Finally suppose that G&#8217; has a dominating set W&#8217; with K vertices. We construct a vertex cover W of G by choosing<\/p>\n<ul>\n<li>every element of W&#8217; that is a vertex of G.<\/li>\n<li>one of the endpoints of the edge e, for every element v<sub>e<\/sub> of W&#8217;.<\/li>\n<\/ul>\n<p>Consider an edge e of G: the vertex v<sub>e<\/sub> of G&#8217; was dominated, which means that either it was in W&#8217; (and so W will contain one of the endpoints of e), or one of its two neighbours (an endpoint of e) is in W. This means W is a vertex cover of G.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>We can rewrite xy as ((x + y)2 &#8211; x2 &#8211; y2)\/2, and hence compute xy using three calls to our square function, and 4 other operations. We construct a new graph G&#8217; = (V, E&#8217;) where E&#8217; contains every pair {x, y} of vertices of G that is NOT an edge of G (that &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blogs.ubc.ca\/cpsc3202017winter2\/tutorial-3-solutions\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Tutorial #3 solutions&#8221;<\/span><\/a><\/p>\n","protected":false},"author":55633,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-2344","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/blogs.ubc.ca\/cpsc3202017winter2\/wp-json\/wp\/v2\/pages\/2344","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.ubc.ca\/cpsc3202017winter2\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/blogs.ubc.ca\/cpsc3202017winter2\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.ubc.ca\/cpsc3202017winter2\/wp-json\/wp\/v2\/users\/55633"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.ubc.ca\/cpsc3202017winter2\/wp-json\/wp\/v2\/comments?post=2344"}],"version-history":[{"count":3,"href":"https:\/\/blogs.ubc.ca\/cpsc3202017winter2\/wp-json\/wp\/v2\/pages\/2344\/revisions"}],"predecessor-version":[{"id":2348,"href":"https:\/\/blogs.ubc.ca\/cpsc3202017winter2\/wp-json\/wp\/v2\/pages\/2344\/revisions\/2348"}],"wp:attachment":[{"href":"https:\/\/blogs.ubc.ca\/cpsc3202017winter2\/wp-json\/wp\/v2\/media?parent=2344"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}