Question

1. Graphs (11 points) (1) (3 points) How many strongly connected components are in the three graphs below? List the vertices

Please answer question 2. Introduction to Trees

Thank you

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1). Out of graphs G1,G2,G3,G4  graph G2 is a tree because :-

Graph G2 is :-

2 op

Graph G2 satisfies all the conditions and properties of a tree which are as :-

  • It has n vertices and (n-1) edges .
  • No loop should be present in tree .
  • All vertices are connected to each other through edges .

While in case of graph G1

- Gತ

it does not satisfies the property of a tree which is :-

A tree must have n vertices and (n-1)edges , so therefore it is not a tree.

In case of graph G3

the edges bcf are forming a loop which is not possible in a tree.So it is not a tree .

In case of graph G4

9

their is also a self loop in edge cf so it is not a tree.

Hence, from the graph G1,G2,G3and G4 , graph G2 is a tree.

2). TO show using induction on l for l>=l , a full binary tree with l leaves has 2l-1 vertices total.

We can prove N = 2l-1 (or N = l+l-1) by induction as :-

Base Case :-

A tree with 1 leaf has 1 node altogether. A tree with 2 leaves has 3 nodes altogether. Base case proves the theorem for L = 1and L=2.

Inductive hypothesis :-

Let's assume that any full binary tree with l leaves has n = 2l-1 total nodes.

Inductive step :-

Prove that all any full binary tree with L+1 leaves has N = 2(L+1)-1 total nodes.

Let T be a full biinary tree with L+1 leaves . Select  a leaf v at maximal depth such that v’s sibling is also a leaf at maximal depth. Remove both v and v’s sibling and let T′ be the resulting tree. T′ is a full binary tree with L leaves which, by our inductive hypothesis, must have 2L−1 total nodes N. Note v’s parent is now a leaf in tree T′. Add v and v’s sibling back to their parent and notice the parent becomes an internal node. Thus, the tree loses one leaf but gains another two (that we added). The number of leaves increased by a total of 1 from L⇒L+1, while the number of nodes increased by two 2L−1+2 = 2L+1. This clearly equals 2(L+1)−1, thus proving by induction that the number of total nodes N in any full binary tree with L leaves is 2L−1.

Add a comment
Know the answer?
Add Answer to:
Please answer question 2. Introduction to Trees Thank you 1. Graphs (11 points) (1) (3 points)...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 7. Graphs u, u2, u3, u4, u5, u6} and the (a) Consider the undirected graph G...

    7. Graphs u, u2, u3, u4, u5, u6} and the (a) Consider the undirected graph G (V, E), with vertex set V set of edges E ((ul,u2), (u2,u3), (u3, u4), (u4, u5), (u5, u6). (u6, ul)} i. Draw a graphical representation of G. ii. Write the adjacency matrix of the graph G ii. Is the graph G isomorphic to any member of K, C, Wn or Q? Justify your answer. a. (1 Mark) (2 Marks) (2 Marks) b. Consider an...

  • Task 3: Grid Graphs and Mazes Part A - Generating Grid Graphs In the lecture we...

    Task 3: Grid Graphs and Mazes Part A - Generating Grid Graphs In the lecture we said that we can use Prim's algorithm to create mazes by starting from a regular "grid graph and then finding a spanning tree. Implement a function grid graph (m, n) that takes as input two positive integers, and returns the adjacency matrix of a m by n grid graphie, a graph with ses vertices that, when drawn on a regular m by n grid,...

  • Graphs (15 points) 14. For the following graph (8 points): a. Find all the edges that...

    Graphs (15 points) 14. For the following graph (8 points): a. Find all the edges that are incident of v1: b. Find all the vertices that are adjacent to v3: C. Find all the edges that are adjacent to e1: d. Find all the loops: e. Find all the parallel edges: f. Find all the isolated vertices: g. Find the degree of v3: h. Find the total degree of the graph: e3 e2 V2 VI 26 e4 e7 es 05...

  • 10. Graphs (2 points) Determine the following for the graph G: a) List the strongly connected...

    10. Graphs (2 points) Determine the following for the graph G: a) List the strongly connected components in G: b) Give the adjacency matrix representation for this graph. a bcd e f

  • TW 45 BOS ORD JFK SFO AA 1387 AA 49 (DFW LAX AA 523 MIA AA...

    TW 45 BOS ORD JFK SFO AA 1387 AA 49 (DFW LAX AA 523 MIA AA 411 Figure 13.2: Example of a directed graph representing a flight network. The end- points of edge UA 120 are LAX and ORD; hence, LAX and ORD are adjacent. The in-degree of DFW is 3, and the out-degree of DFW is 2. a. Give the indegree and outdegree of each vertex (5 points) b. Draw an edge-list representation for this graph (as discussed on...

  • 1. Draw all non-isomorphic simple graphs with 5 vertices and 0, 1, 2, or 3 edges;...

    1. Draw all non-isomorphic simple graphs with 5 vertices and 0, 1, 2, or 3 edges; the graphs need not be connected. Do not label the vertices of your graphs. You should not include two graphs that are isomorphic. 2. Give the matrix representation of the graph H shown below.

  • For a directed graph the in-degree of a vertex is the number of edges it has...

    For a directed graph the in-degree of a vertex is the number of edges it has coming in to it, and the out- degree is the number of edges it has coming out. (a) Let G[i,j] be the adjacency matrix representation of a directed graph, write pseudocode (in the same detail as the text book) to compute the in-degree and out-degree of every vertex in the Page 1 of 2 CSC 375 Homework 3 Spring 2020 directed graph. Store results...

  • 1. Draw all non-isomorphic simple graphs with 5 vertices and 0, 1, 2, or 3 edges;...

    1. Draw all non-isomorphic simple graphs with 5 vertices and 0, 1, 2, or 3 edges; the graphs need not be connected. Do not label the vertices of your graphs. You should not include two graphs that are isomorphic. 2. Give the matrix representation of the graph H shown below. 3. Question 3 on next page. Place work in this box. Continue on back if needed. D E F А B

  • Help 2 2. II. Use the previous graphs to create the following: 1. Adjacency matrix for...

    Help 2 2. II. Use the previous graphs to create the following: 1. Adjacency matrix for G in 1. 2. Incidence matrix for G in 1. 3. Adjacency list for G in 3. 4. Adjacency matrix for I in 5. 5. What is the degree of vertex a in 2. 6. If is a subgraph from G in 2. II-(K, L) is a complete graph, K-(b,c,d) and K C V. Draw the graph

  • Problem 3 (15 points). Let G (V,E) be the following directed graph. a. 1. Draw the...

    Problem 3 (15 points). Let G (V,E) be the following directed graph. a. 1. Draw the reverse graph G of G. 2. Run DFS on G to obtain a post number for each vertex. Assume that in the adjacency list representation of G, vertices are stored alphabetically, and in the list for each vertex, its adjacent vertices are also sorted alphabetically. In other words, the DFS algorithm needs to examine all vertices alphabetically, and when it traverses the adjacent vertices...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT