Construct as complete a graph as possible. Construction of graphs based on their characteristics. Graph problems to reinforce basic concepts

Keywords:

  • graphic object
  • computer graphics
  • raster graphics
  • Vector graphics
  • formats graphic files

Drawings, paintings, drawings, photographs and other graphic images will be called graphic objects.

3.2.1. Areas of application of computer graphics

Computer graphics have become a part of our daily life. It applies:

  • for a visual presentation of the results of measurements and observations (for example, data on climate change over a long period, on the dynamics of animal populations, on the ecological state of various regions, etc.), the results of sociological surveys, planned indicators, statistical data, the results of ultrasound studies in medicine, etc.;
  • when developing interior and landscape designs, designing new buildings, technical devices and other products;
  • in simulators and computer games to simulate various kinds of situations that arise, for example, during the flight of an airplane or spacecraft, the movement of a car, etc.;
  • when creating all kinds of special effects in the film industry;
  • when developing modern user interfaces software and network information resources;
  • for human creative expression (digital photography, digital painting, computer animation, etc.).

Examples of computer graphics are shown in Fig. 3.5.

Rice. 3.5.
Computer graphics examples

  • http://snowflakes.barkleyus.com/ - using computer tools you can “cut out” any snowflake;
  • http://www.pimptheface.com/create/ - you can create a face using a large library of lips, eyes, eyebrows, hairstyles and other fragments;
  • http://www.ikea.com/ms_RU/rooms_ideas/yoth/index.html - try to choose new furniture and finishing materials for your room.

3.2.2. Methods for creating digital graphics

Graphic objects created or processed using a computer are stored on computer media; if necessary, they can be printed on paper or other suitable media (film, cardboard, fabric, etc.).

We will call graphic objects on computer media digital graphic objects.

There are several ways to obtain digital graphic objects.

  1. copying finished images from a digital camera, from external memory devices or “downloading” them from the Internet;
  2. input of graphic images existing on paper using a scanner;
  3. creating new graphics using software.

The principle of operation of the scanner is to break the image available on paper into tiny squares - pixels, determine the color of each pixel and store it in binary code in the computer memory.

The quality of the image obtained as a result of scanning depends on the size of the pixel: the smaller the pixel, the more pixels the original image will be divided into and the more complete information about the image will be transferred to the computer.

Pixel sizes depend on the resolution of the scanner, which is usually expressed in dpi (dot per inch - dots per inch 1) and is specified by a pair of numbers (for example, 600 x 1200 dpi). The first number is the number of pixels that can be extracted by the scanner in a 1-inch-long image line. The second number is the number of lines into which a 1-inch-high strip of image can be divided.

    1 Inch is a unit of length in the English system of measures, equal to 2.54 cm.

Task. A color image measuring 10 x 10 cm is scanned. The scanner resolution is 1200 x 1200 dpi, color depth is 24 bits. What information volume will the resulting graphic file have?

Solution. The scanned image measures approximately 4" x 4". Taking into account the resolution of the scanner, the entire image will be divided into 4 4 1200 1200 pixels.

Answer: approximately 66 MB.

We recommend that you watch the animations “Scanners: general principles of operation”, “Scanners: flatbed scanner”, posted in the Unified Collection of Digital Educational Resources (http://school-collection.edu.ru/). These resources will help you better understand how the scanning process works. The “Digital Camera” resource will illustrate how digital photographs are taken (Fig. 3.6).

Rice. 3.6.
Flatbed scanner and digital camera

3.2.3. Raster and vector graphics

Depending on the creation method graphic image There are raster, vector and fractal graphics.

Raster graphics

IN raster graphics The image is formed in the form of a raster - a collection of points (pixels) forming rows and columns. Each pixel can take on any color from a palette containing millions of colors. Color accuracy is the main advantage of raster graphics. When a raster image is saved in computer memory, information about the color of each pixel included in it is stored.

The quality of a raster image increases with the number of pixels in the image and the number of colors in the palette. At the same time, the information volume of the entire image increases. Large information volume is one of the main disadvantages of raster images.

The next disadvantage of raster images is associated with some difficulties when scaling them. Thus, when a raster image is reduced, several neighboring pixels are converted into one, which leads to a loss of clarity in small details of the image. When a raster image is enlarged, new pixels are added to it, while neighboring pixels take on the same color and a step effect occurs (Fig. 3.7).

Rice. 3.7.
Raster image and its enlarged fragment

Raster graphics are rarely created by hand. Most often they are obtained by scanning illustrations or photographs prepared by artists; Recently, digital cameras have been widely used to input raster images into a computer.

Vector graphics

Many graphic images can be presented as a collection of segments, circles, arcs, rectangles and other geometric shapes. For example, the image in Fig. 3.8 consists of circles, segments and a rectangle.

Rice. 3.8.
An image made of circles, segments and a rectangle

Each of these figures can be described mathematically: segments and rectangles - by the coordinates of their vertices, circles - by the coordinates of their centers and radii. In addition, you can set the thickness and color of lines, fill color and other properties of geometric shapes. IN vector graphics images are formed on the basis of such data sets (vectors) describing graphic objects and formulas for their construction. When saving a vector image, information about the simplest geometric objects that make it up is entered into the computer’s memory.

The information volumes of vector images are much smaller information volumes raster images. For example, to depict a circle using raster graphics, you need information about all the pixels of the square area in which the circle is inscribed; To depict a circle using vector graphics, only the coordinates of one point (the center) and the radius are required.

Another advantage of vector images is the ability to scale them without losing quality (Fig. 3.9). This is due to the fact that with each transformation of a vector object, the old image is deleted, and instead of it, a new one is constructed using existing formulas, but taking into account the changed data.

Rice. 3.9.
A vector image, its converted fragment and the simplest geometric shapes from which this fragment is “assembled”

At the same time, not every image can be represented as a collection of simple geometric shapes. This method of presentation is good for drawings, diagrams, business graphics and other cases where maintaining sharp and clear outlines of images is of particular importance.

Fractal graphics, like vector graphics, are based on mathematical calculations. But, unlike vector graphics, the computer memory stores not descriptions of the geometric shapes that make up the image, but the mathematical formula (equation) itself, which is used to construct the image. Fractal images are varied and bizarre (Fig. 3.10).

Rice. 3.10.
Fractal graphics

You can find more complete information on this issue on the Internet (for example, at http://ru.wikipedia.org/wiki/Fractal).

3.2.4. Graphic file formats

A graphics file format is a way of representing graphic data on external media. There are raster and vector formats of graphic files, among which, in turn, there are universal graphic formats and proprietary (original) formats of graphic applications.

Universal graphic formats are “understood” by all applications that work with raster (vector) graphics.

The universal raster graphics format is the BMP format. Graphic files in this format have a large information volume, since they allocate 24 bits to store information about the color of each pixel.

Drawings saved in the universal bitmap format GIF can only use 256 different colors. This palette is suitable for simple illustrations and pictograms. Graphic files of this format have a small information volume. This is especially important for graphics used in World Wide Web, whose users want the information they requested to appear on the screen as quickly as possible.

The universal raster format JPEG is designed specifically for efficient image storage photographic quality. Modern computers provide reproduction of more than 16 million colors, most of which are simply indistinguishable to the human eye. JPEG format allows you to discard the variety of colors of neighboring pixels that are “excessive” for human perception. Some of the original information is lost, but this ensures a reduction in the information volume (compression) of the graphic file. The user is given the opportunity to determine the degree of file compression. If the image being saved is a photograph that is supposed to be printed on a large-format sheet, then loss of information is undesirable. If this photograph is posted on a Web page, then it can be safely compressed tens of times: the remaining information will be enough to reproduce the image on the monitor screen.

Universal vector graphic formats include the WMF format, used to store a collection of Microsoft pictures (http://office.microsoft.com/ru-ru/clipart).

The universal EPS format allows you to store information about both raster and vector graphics. It is often used to import 2 files into printing programs.

    2 The process of opening a file in a program in which it was not created.

You will become familiar with your own formats directly in the process of working with graphic applications. They provide best ratio image quality and information volume of the file, but are supported (i.e. recognized and reproduced) only by the application itself that creates the file.

Problem 1. To encode one pixel, 3 bytes are used. The photo, measuring 2048 x 1536 pixels, was saved as an uncompressed file. Determine the size of the resulting file.

Solution.

Answer: 9 MB.

Problem 2. An uncompressed 128 x 128 pixel bitmap image takes up 2 KB of memory. What is the maximum possible number of colors in the image palette?

Solution.

Answer: 2 colors - black and white.

The most important

Computer graphics is a broad concept that refers to: 1) different types of graphic objects created or processed using computers; 2) an area of ​​activity in which computers are used as tools for creating and processing graphic objects.

Depending on the method of creating a graphic image, raster and vector graphics are distinguished.

In raster graphics, an image is formed in the form of a raster - a collection of dots (pixels) forming rows and columns. When a raster image is saved in computer memory, information about the color of each pixel included in it is stored.

In vector graphics, images are formed on the basis of data sets (vectors) describing a particular graphic object and formulas for their construction. When saving a vector image, information about the simplest geometric objects that make it up is entered into the computer’s memory.

A graphics file format is a way of representing graphic data on external media. There are raster and vector formats of graphic files, among which, in turn, there are universal graphic formats and proprietary formats of graphic applications.

Questions and tasks

  1. What is computer graphics?
  2. List the main areas of application of computer graphics.
  3. How can digital graphics be produced?
  4. A color image measuring 10 x 15 cm is scanned. The scanner resolution is 600 x 600 dpi, color depth is 3 bytes. What information volume will the resulting graphic file have?
  5. What is the difference between raster and vector methods of representing an image?
  6. Why is it believed that raster images convey color very accurately?
  7. Which operation of converting a raster image leads to the greatest loss of its quality - reduction or enlargement? How can you explain this?
  8. Why doesn't scaling affect the quality of vector images?
  9. How can you explain the variety of graphic file formats?
  10. What is the main difference between universal graphics formats and proprietary graphics application formats?
  11. Construct as complete a graph as possible for the concepts in section 3.2.4.
  12. Give a detailed description of raster and vector images, indicating the following:

      a) from what elements the image is built;

      b) what information about the image is stored in external memory;

      c) how the size of a file containing a graphic image is determined;

      d) how image quality changes when scaling;

      e) what are the main advantages and disadvantages of raster (vector) images.

  13. The 1024 x 512 pixel drawing was saved as an uncompressed 1.5 MB file. How much information was used to encode the pixel's color? What is the maximum possible number of colors in a palette corresponding to this color depth?
  14. An uncompressed 256 x 128 pixel bitmap image takes up 16 KB of memory. What is the maximum possible number of colors in the image palette?

Graphics file format is a way of representing graphical data on external media. Distinguish raster and vector formats graphic files, among which, in turn, there are universal graphic formats And own (original) formats of graphic applications.

Universal graphic formats are “understood” by all applications that work with raster (vector) graphics.

The universal raster graphics format is BMP format. Graphic files in this format have a large information volume, since they allocate 24 bits to store information about the color of each pixel.

In drawings saved in a universal bitmap GIF format, you can only use 256 different colors. This palette is suitable for simple illustrations and pictograms. Graphic files of this format have a small information volume. This is especially important for graphics used on the World Wide Web, where users want the information they request to appear on the screen as quickly as possible.

Universal raster JPEG format Designed specifically for efficient storage of photographic quality images. Modern computers can reproduce more than 16 million colors, most of which are simply indistinguishable to the human eye. The JPEG format allows you to discard the variety of colors of neighboring pixels that are “excessive” for human perception. Some of the original information is lost, but this ensures a reduction in the information volume (compression) of the graphic file. The user is given the opportunity to determine the degree of file compression. If the image being saved is a photograph that is supposed to be printed on a large-format sheet, then loss of information is undesirable. If this photo is placed on a Web page, then it can be safely compressed tens of times: the remaining information will be enough to reproduce the image on the monitor screen.

Universal vector graphic formats include WMF format, used to store a collection of Microsoft pictures.

Universal EPS format allows you to store information about both raster and vector graphics. It is often used to import files into print production programs.

You will become familiar with your own formats directly in the process of working with graphic applications. They provide the best ratio of image quality and file information volume, but are supported (i.e. recognized and played) only by the application itself that creates the file.

Task 1.
To encode one pixel, 3 bytes are used. The photo, measuring 2048 x 1536 pixels, was saved as an uncompressed file. Determine the size of the resulting file.

Solution:
i = 3 bytes
K= 2048 1536
I — ?

I=K i
I = 2048 1536 3 = 2 2 10 1.5 2 10 3 = 9 2 20 (bytes) = 9 (MB).

Answer: 9MB.

Task 2.
An uncompressed 128 x 128 pixel bitmap image takes up 2 KB of memory. What is the maximum possible number of colors in the image palette?

Solution:
K = 128 128
I = 2 KB
N -?

I=K i
i=I/K
N=2 i
i = (2 1024 8)/(128 128) = (2 2 10 2 3) /(2 7 2 7) = 2 1+10+3 /2 7+7 = 2 14 /2 14 = 1 (bit) .
N = 2 1 = 2.

Answer: 2 colors - black and white.

The most important:

  • A graphics file format is a way of representing graphic data on external media. There are raster and vector formats of graphic files, among which, in turn, there are universal graphic formats and proprietary formats of graphic applications.

Graph theory is a branch of discrete mathematics that studies objects represented as individual elements (vertices) and connections between them (arcs, edges).

Graph theory originates from the solution of the problem of the Königsberg bridges in 1736 by the famous mathematician Leonard Euler(1707-1783: born in Switzerland, lived and worked in Russia).

Problem about the Königsberg bridges.

There are seven bridges in the Prussian town of Königsberg on the Pregal River. Is it possible to find a walking route that crosses each bridge exactly once and starts and ends in the same place?

A graph in which there is a route that starts and ends at the same vertex and passes along all the edges of the graph exactly once is calledEuler graph.

The sequence of vertices (maybe repeated) through which the desired route passes, as well as the route itself, is calledEuler cycle .

The problem of three houses and three wells.

There are three houses and three wells, somehow located on a plane. Draw a path from each house to each well so that the paths do not intersect. This problem was solved (it was shown that there is no solution) by Kuratovsky (1896 - 1979) in 1930.

The four color problem. Partitioning a plane into non-intersecting areas is called by card. Map areas are called adjacent if they have a common border. The task is to color the map in such a way that no two adjacent areas are painted with the same color. Since the end of the 19th century, a hypothesis has been known that four colors are enough for this. The hypothesis has not yet been proven.

The essence of the published solution is to enumerate a large but finite number (about 2000) types of potential counterexamples to the four-color theorem and show that not a single case is a counterexample. This search was completed by the program in about a thousand hours of supercomputer operation.

It is impossible to check the resulting solution “manually” - the scope of enumeration is beyond the scope of human capabilities. Many mathematicians raise the question: can such a “program proof” be considered a valid proof? After all, there may be errors in the program...

Thus, we can only rely on the programming skills of the authors and believe that they did everything right.

Definition 7.1. Count G= G(V, E) is a collection of two finite sets: V – called many vertices and the set E of pairs of elements from V, i.e. EÍV´V, called many edges, if the pairs are unordered, or many arcs, if the pairs are ordered.

In the first case, the graph G(V, E) called unoriented, in the second – oriented.


EXAMPLE. A graph with a set of vertices V = (a,b,c) and a set of edges E =((a, b), (b, c))

EXAMPLE. A graph with V = (a,b,c,d,e) and E = ((a, b), (a, e), (b, e), (b, d), (b, c) , (c, d)),

If e=(v 1 ,v 2), еОЕ, then they say that the edge is e connects vertices v 1 and v 2.

Two vertices v 1,v 2 are called adjacent, if there is an edge connecting them. In this situation, each of the vertices is called incident corresponding edge .

Two different ribs adjacent, if they have a common vertex. In this situation, each of the edges is called incidental corresponding vertex .

Number of graph vertices G let's denote v, and the number of edges is e:

.

The geometric representation of the graphs is as follows:

1) the vertex of the graph is a point in space (on the plane);

2) an edge of an undirected graph – a segment;

3) an arc of a directed graph – a directed segment.

Definition 7.2. If in the edge e=(v 1 ,v 2) v 1 =v 2 occurs, then the edge e is called loop. If a graph allows loops, then it is called graph with loops or pseudograph .

If a graph allows more than one edge between two vertices, then it is called multigraph .

If each vertex of a graph and/or edge is labeled, then such a graph is called marked (or loaded ). Letters or integers are usually used as marks.

Definition 7.3. Graph G(V, E) called subgraph (or part ) graph G(V,E), If V V, E E. If V= V, That G called spanning subgraph G.

Example 7 . 1 . Given an undirected graph.



Definition 7.4. The graph is called complete , If any its two vertices are connected by an edge. Complete graph with n vertices is denoted by K n .

Counts K 2 , TO 3, TO 4 and K 5 .

Definition 7.5. Graph G=G(V, E) is called dicotyledonous , If V can be represented as a union of disjoint sets, say V=AB, so each edge has the form ( v i , v j), Where v iA And v jB.

Each edge connects a vertex from A to a vertex from B, but no two vertices from A or two vertices from B are connected.

A bipartite graph is called complete dicotyledon count K m , n, If A contains m peaks, B contains n vertices and for each v iA, v jB we have ( v i , v j)E.

Thus, for everyone v iA, And v jB there is an edge connecting them.

K 12 K 23 K 22 K 33

Example 7 . 2 . Construct a complete bipartite graph K 2.4 and the full graph K 4 .

Unit graphn-dimensional cubeIN n .

The vertices of the graph are n-dimensional binary sets. Edges connect vertices that differ in one coordinate.

Example:

It is advisable to introduce the concept of a graph after several problems similar to Problem 1 have been analyzed, the decisive consideration in which is graphical representation. It is important that students immediately realize that the same graph can be drawn different ways. In my opinion, there is no need to give a strict definition of a graph, because it is too cumbersome and will only complicate the discussion. At first, an intuitive concept will suffice. When discussing the concept of isomorphism, you can solve several exercises to identify isomorphic and non-isomorphic graphs. One of the central points of the topic is the theorem on the parity of the number of odd vertices. It is important that students fully understand its proof and learn how to apply it to problem solving. When analyzing several problems, I recommend not referring to the theorem, but actually repeating its proof. The concept of graph connectivity is also extremely important. A meaningful consideration here is the consideration of the connectivity component; special attention must be paid to this. Euler graphs are almost a game topic.

The first and main goal that needs to be pursued when studying graphs is to teach schoolchildren to see the graph in the problem statement and to correctly translate the condition into the language of graph theory. You shouldn’t tell both of them to everyone in several classes in a row. It is better to spread classes over 2–3 academic years. (Attached is the development of the lesson “The concept of a graph. Application of graphs to problem solving” in 6th grade).

2. Theoretical material for the topic “Graphs”.

Introduction

Graphs are wonderful mathematical objects; with their help you can solve a lot of different, outwardly dissimilar problems. There is a whole section in mathematics - graph theory, which studies graphs, their properties and applications. We will discuss only the most basic concepts, properties of graphs and some ways to solve problems.

Concept of a graph

Let's consider two problems.

Task 1. Space communication has been established between the nine planets of the solar system. Regular rockets fly on the following routes: Earth - Mercury; Pluto - Venus; Earth - Pluto; Pluto - Mercury; Mercury - Vienna; Uranus - Neptune; Neptune - Saturn; Saturn – Jupiter; Jupiter - Mars and Mars - Uranus. Is it possible to fly on regular rockets from Earth to Mars?

Solution: Let's draw a diagram of the condition: we will depict the planets as points, and the rocket routes as lines.

Now it is immediately clear that it is impossible to fly from Earth to Mars.

Task 2. The board has the shape of a double cross, which is obtained by removing the corner squares from a 4x4 square.

Is it possible to bypass it by moving a chess knight and return to the original square, having visited all squares exactly once?

Solution: Let's number the squares of the board sequentially:

And now, using the figure, we will show that such a traversal of the table, as indicated in the condition, is possible:

We considered two dissimilar problems. However, the solutions to these two problems are united by a common idea - a graphical representation of the solution. At the same time, the pictures drawn for each task turned out to be similar: each picture consists of several dots, some of which are connected by lines.

Such pictures are called graphs. The points are called peaks, and the lines – ribs graph. Note that not every picture of this type will be called a graph. For example. if you are asked to draw a pentagon in your notebook, then such a drawing will not be a graph. We will call a drawing of this type, as in the previous problems, a graph if there is some specific task for which such a drawing was constructed.

Another note concerns the appearance of the graph. Try to check that the graph for the same problem can be drawn in different ways; and vice versa, for different tasks you can draw graphs of the same appearance. All that matters here is which vertices are connected to each other and which are not. For example, the graph for task 1 can be drawn differently:

Such identical, but differently drawn graphs are called isomorphic.

Degrees of vertices and counting the number of edges of a graph

Let's write down one more definition: The degree of a vertex in a graph is the number of edges emerging from it. In this regard, a vertex with an even degree is called an even vertex, respectively, a vertex with an odd degree is called an odd vertex.

One of the main theorems of graph theory is related to the concept of vertex degree - the theorem on the fairness of the number of odd vertices. We will prove it a little later, but first, for illustration, we will consider the problem.

Task 3. There are 15 telephones in the town of Malenky. Is it possible to connect them with wires so that each phone is connected to exactly five others?

Solution: Let's assume that such a connection between telephones is possible. Then imagine a graph in which the vertices represent telephones, and the edges represent the wires connecting them. Let's count how many wires there are in total. Each phone has exactly 5 wires connected, i.e. the degree of each vertex of our graph is 5. To find the number of wires, you need to sum up the degrees of all the vertices of the graph and divide the resulting result by 2 (since each wire has two ends, then when summing the degrees, each wire will be taken 2 times). But then the number of wires will be different. But this number is not an integer. This means that our assumption that each phone can be connected to exactly five others turned out to be incorrect.

Answer. It is impossible to connect phones this way.

Theorem: Any graph contains an even number of odd vertices.

Proof: The number of edges of a graph is equal to half the sum of the degrees of its vertices. Since the number of edges must be an integer, the sum of the degrees of the vertices must be even. And this is only possible if the graph contains an even number of odd vertices.

Graph connectivity

There is another important concept related to graphs - the concept of connectivity.

The graph is called coherent, if any two of its vertices can be connected by, those. continuous sequence of edges. There are a number of problems whose solution is based on the concept of graph connectivity.

Task 4. There are 15 cities in the country of Seven, each city is connected by roads to at least seven others. Prove that it is fashionable to get from every city to any other.

Proof: Consider two arbitrary cities A and B and assume that there is no path between them. Each of them is connected by roads to at least seven others, and there is no city that is connected to both cities in question (otherwise there would be a path from A to B). Let's draw a part of the graph corresponding to these cities:

Now it is clearly visible that we have received at least 16 different cities, which contradicts the conditions of the problem. This means the statement has been proven by contradiction.

If we take into account the previous definition, then the statement of the problem can be reformulated in another way: “Prove that the road graph of the country Seven is connected.”

Now you know what a connected graph looks like. A disconnected graph has the form of several “pieces”, each of which is either a separate vertex without edges or a connected graph. You can see an example of a disconnected graph in the figure:

Each such individual piece is called connected component of the graph. Each connected component represents a connected graph and all the statements that we have proven for connected graphs hold for it. Let's look at an example of a problem that uses a connected component:

Problem 5. In the Far Far Away Kingdom there is only one type of transport - a flying carpet. There are 21 carpet lines leaving the capital, one from the city of Dalniy, and 20 from all other cities. Prove that you can fly from the capital to the city of Dalniy.

Proof: It is clear that if you draw a graph of the carpet of the Kingdom, it may be incoherent. Let's look at the connectivity component that includes the Kingdom capital. There are 21 carpets coming out of the capital, and 20 from any other city except the city of Dalniy, therefore, in order for the law on an even number of odd vertices to be fulfilled, it is necessary that the city of Dalniy be included in the same component of connectivity. And since the connected component is a connected graph, then from the capital there is a path along the carpets to the city of Dalniy, which was what needed to be proven.

Euler graphs

You've probably encountered tasks in which you need to draw a shape without lifting your pencil from the paper and drawing each line only once. It turns out that such a problem is not always solvable, i.e. There are figures that cannot be drawn using this method. The question of the solvability of such problems is also included in graph theory. It was first explored in 1736 by the great German mathematician Leonhard Euler, solving the problem of the Königsberg bridges. Therefore, graphs that can be drawn in this way are called Euler graphs.

Task 6. Is it possible to draw the graph shown in the figure without lifting the pencil from the paper and drawing each edge exactly once?

Solution. If we draw the graph as stated in the condition, then we will enter each vertex, except the initial and final ones, the same number of times as we exit it. That is, all vertices of the graph, except two, must be even. Our graph has three odd vertices, so it cannot be drawn in the way specified in the condition.

Now we have proven the theorem about Euler graphs:

Theorem: An Euler graph must have at most two odd vertices.

And in conclusion - the problem of the Königsberg bridges.

Task 7. The figure shows a diagram of bridges in the city of Königsberg.

Is it possible to take a walk so that you cross each bridge exactly once?

3. Problems for the topic “Graphs”

The concept of a graph.

1. On a 3x3 square board, 4 knights are placed as shown in Fig. 1. Is it possible, after making several moves with the knights, to rearrange them to the position shown in Fig. 2?

Rice. 1

Rice. 2

Solution. Let's number the squares of the board as shown in the figure:

Let us assign a point on the plane to each cell, and if one cell can be reached by moving a chess knight from one cell, then we will connect the corresponding points with a line. The initial and required placement of the knights are shown in the figures:

For any sequence of knight moves, their order obviously cannot change. Therefore, it is impossible to rearrange the horses in the required manner.

2. In the country of Digit there are 9 cities with names 1, 2, 3, 4, 5, 6, 7, 8, 9. A traveler discovered that two cities are connected by an airline if and only if the two-digit number formed by the names cities, divided by 3. Is it possible to fly by air from city 1 to city 9?

Solution. By assigning a dot to each city and connecting the dots with a line, if the sum of the numbers is divisible by 3, we get a graph in which the numbers 3, 5, 9 are connected to each other, but not connected to the rest. This means that you cannot fly from city 1 to city 9.

Degrees of vertices and counting the number of edges.

3. There are 100 cities in a state, and each city has 4 roads. How many roads are there in the state?

Solution. Let's count the total number of roads leaving the city - 100 . 4 = 400. However, with this calculation, each road is counted 2 times - it leaves one city and enters another. This means that there are two times fewer roads in total, i.e. 200.

4. There are 30 people in the class. Could it be that 9 people have 3 friends, 11 have 4 friends, and 10 have 5 friends?

Answer. No (theorem on the parity of the number of odd vertices).

5. The king has 19 vassals. Could it be that each vassal has 1, 5 or 9 neighbors?

Answer. No, he can not.

6. Can a state in which exactly 3 roads exit from each city have exactly 100 roads?

Solution. Let's count the number of cities. The number of roads is equal to the number of cities x multiplied by 3 (the number of roads leaving each city) and divided by 2 (see problem 3). Then 100 = 3x/2 => 3x = 200, which cannot happen with natural x. This means there cannot be 100 roads in such a state.

7. Prove that the number of people who have ever lived on Earth and made an odd number of handshakes is even.

The proof follows directly from the theorem on the parity of the number of odd vertices in a graph.

Connectivity.

8. In the country, 100 roads leave each city and from each city you can get to any other. One road was closed for repairs. Prove that now you can get from any city to any other.

Proof. Let's consider the connectivity component, which includes one of the cities, the road between which was closed. By the theorem on the parity of the number of odd vertices, it also includes the second city. This means you can still find a route and get from one of these cities to another.

Euler graphs.

9. There is a group of islands connected by bridges so that from each island you can get to any other. The tourist walked around all the islands, crossing each bridge once. He visited Threefold Island three times. How many bridges lead from Troyekratnoye if a tourist

a) didn’t start with it and didn’t end with it?
b) started with it, but didn’t finish with it?
c) started with it and ended with it?

10. The picture shows a park divided into several parts by fences. Is it possible to walk through the park and its surroundings so that you can climb over each fence once?

Null graph and complete graph.

There are some special graphs that appear in many applications of graph theory. For now, we will again consider the graph as a visual diagram illustrating the course of sports competitions. Before the start of the season, while no games have been played yet, there are no edges in the graph. Such a graph consists of only isolated vertices, i.e. of vertices connected by no edges. We will call a graph of this type null graph. In Fig. 3 shows such graphs for cases when the number of commands, or vertices, is 1, 2, 3, 4 and 5. These null graphs are usually denoted by the symbols O1, O2, O3, etc., so On is a null a graph with n vertices and no edges.

Let's consider another extreme case. Let's assume that at the end of the season, each team plays one game against each of the other teams. Then on the corresponding graph each pair of vertices will be connected by an edge. Such a graph is called complete graph. Figure 4 shows complete graphs with the number of vertices n = 1, 2, 3, 4, 5. We denote these complete graphs by U1, U2, U3, U4 and U5, respectively, so that the graph Un consists of 11 vertices and edges, connecting all possible pairs of these vertices. This graph can be thought of as an n-gon in which all the diagonals are drawn.


Having some graph, for example the graph G shown in Fig. 1, we can always turn it into a complete graph with the same vertices by adding the missing edges (that is, edges corresponding to games that are yet to be played). In Fig. 5 we did this for the graph in Fig. 1 (games that have not yet taken place are shown in dotted lines). You can also separately draw a graph corresponding to future games that have not yet been played. For graph G this will result in the graph shown in Fig. 6.

We call this new graph the complement of graph G; It is customary to denote it by G1. Taking the complement of graph G1, we again obtain graph G. The edges of both graphs G1 and G together form a complete graph.




Top