
Title:
Subsets  Intro to Algorithms

Description:

The first part of the subset question asks about planar graphs and trees.

The first thing to note is that not all planar graphs are trees.

For example, here's a ring, which is a planar graph and it's not a tree.

And so planar graphs are not a subset of trees. On the other hand, all trees are planar graphs.

For most trees, it's fairly intuitive to see how it can be drawn in the plane.

For example, this one is already planar.

But for other trees, it might not be so obvious that we can rearrange everything

to lay it outside in the plane, and so it'd be nice to have a proof that all trees are planar

instead of relying just on intuition.

One way to prove this is to show that any tree can be drawn inside of a triangle.

And then larger trees can be constructed by combining these triangles.

More formally, what we want to show is that any tree can be drawn in a plane inside a triangle

with any given node at the apex of the triangle.

And so for the base case of one node, we can draw the node at the apex of the triangle

and this is trivially in a plane.

And so, our inductive step is to assume that the claim is true for all graphs with less than n nodes.

And we want to show that the claim is true for all graphs with n nodes.

So we'll start with a tree with n nodes. We use this for example.

We're going to pick any node kind of at random and we'll call it r.

For example, one of this node be r. And then we remove r.

Because our original graph was a tree, this separates the graph into separate disjoint trees.

And now since each of these trees have less than n nodes,

we can draw each one inside of a triangle.

First, we can take this tree of four nodes and draw it inside of the triangle.

Notice that the node that was connected to r is at the apex of the triangle.

And then we could do the same for the other two trees.

And then in our last step, we'll make a bigger triangle and we put r at the apex

and then connect it to the apexes of the other triangles.

This verifies our claim and shows that all tree graphs are planar.

They are definitely neither due to the definition of trees.

A tree can have no cycles and a ring must have a cycle.

The answer is neither. >>Yeah. >>Cool.

I never got a really specific definition of a chain besides just the example which was enough but

Yeah, same idea kind of a chain doesn't have a cycle whereas a ring does.

And the other thing we got definitely was that the edges in the chain is the number of nodes minus 1

and the edges in the ring is equal to the nodes.

Therefore, there can be no crossover between them. They're mutually exclusive.

All chains are trees but not all trees are chains and so its the first one.

It satisfies the definition of a tree graph that it's connected but there are no cycles,

and then the other description of a tree graph that every pair of nodes in the graphs

has a unique path between them.

I mean a chain does that also.

This is definitely one that answer intuitively by looking at the examples.

It gives me 100% confidence in making that claim.

Yeah and just kind of a quick example ofthat's a tree and that is not a chain so

Correct. And the way I convinced myself of that is drawing an example of a hypercube

that was not a ring and a ring that was not a hypercube.

Unless you have a ring that is anything but four nodes it's not a hypercube.

Okay. >>And any hypercube that's anything but four nodes is definitely not a ring.

Great. So yeah I'll draw one for you and it's just a normal cube.

Right. >>And our second to the last problem is just grids and chains.

All chains are grids but not all grids are chains so it's thechains are the opposite of grids.

Yeah. >>Any chain within nodes is a 1xn grid.

Once you get a grid that has more than one in either of the two directions, it's no longer a chain.

And no matter how long you make a chain >>Yeah. So this is

You can add a node to the chaina node of n to the chain, that makes it not a grid.

Kind of the first thing you said we have like a 1xn grid and it's also a chain but yeah.

Yeah. This is for example not a chain. >>Correct. >>Cool.