Problem

Flood fill / image processing. A Picture is a two-dimensional array of Col o r values (see...

Flood fill / image processing. A Picture is a two-dimensional array of Col o r values (see Section 3.1) that represent pixels. A blob is a collection of neighboring pixels of the same color. Write a Graph client whose constructor creates a grid graph (see Exercise 4.5.27) from a given image and supports the flood fill operation. Given pixel coordinates col and row and a color color, change the color of that pixel and all the pixels in the same blob to color.

EXERCISE 4.5.27

In a grid graph, vertices are arranged in an /7-by-n grid, with edges connecting each vertex to its neighbors above, below, to the left, and to the right in the grid. Compose a Smal 1 Worl d and Graph client that generates grid graphs and tests whether they exhibit the small-world phenomenon (first do Exercise 4.5.23).

6-by-6 grid graph

EXERCISE 4.5.23

Add to SmallWorld (Program 4.5.5) the function isSmallWorld() that takes a graph as an argument and returns true if the graph exhibits the small-world phenomenon (as defined by the specific thresholds given in the text) and false otherwise.

Program 4.5.5 Small-world test

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search