We define a two-player combinatorial game in which players take alternate turns; each turn consists of deleting a vertex of a graph, together with all the edges containing such vertex. If any vertex became isolated by a player’s move then it would also be deleted. A player wins the game when the other player has no moves available. We study this game under various viewpoints: by finding specific strategies for certain families of graphs, through using properties of a graph’s automorphism group, by writing a program to look at Sprague-Grundy numbers, and by studying the game when played on random graphs. When analyzing Grim played on paths, using the Sprague-Grundy function, we find a connection to a standing open question about Octal games.

1. Introduction

In this article we define a two-person game played on the vertices of a graph and then study it to find strategies for either player to win. The analysis of the game ends up depending heavily on the family of graphs considered at the time. This is why, in this article, we will consider a wide variety of tools from game theory, combinatorics, and group theory, plus some programming, to attack this problem. In the following section we will cover some basic notation and definitions that will be useful throughout the paper, as well as the actual game play.

A graph is a set of vertices and a set of edges connecting pairs of vertices. In this work we consider only graphs that are finite, simple, and undirected. As customary, the degree of a vertex , denoted as , is the number of edges that are incident with . We say that a vertex is isolated if . A graph is said to be connected if, given any two vertices , there is a path in from to . Two graphs are said to be disjoint when their vertex sets are disjoint; we will use the notation for the graph formed by two disjoint graphs, and . The join of two graphs and , denoted as , is the graph with vertex set and edge-set . Finally, we will denote paths, cycles, and wheels by , , and , respectively, where is the number of vertices in the graph, and will denote the graph with and edges connecting only vertices that were not connected in . More information about graphs may be found in [1].

In order to define our game we rephrase well-known notions in combinatorial game theory for a game played on graphs. For further reading about game theory, we direct the reader to [2].

Definition 1. A two-player game is said to be impartial if the outcome of the game depends only on which player goes first. A two-player game is said to be combinatorial if both players have perfect information, there is no chance involved, the game ends after a finite number of moves, the game is impartial, and there is no draw. A two-player game is said to be normal if the last player to make a legal move is the winner.

Definition 2. Let and be graphs on which a combinatorial game can be played. (1)If is obtained from after a game move, then we will call a follower of in the game.(2)If, given a graph , there is a strategy to win for the next player making a move then we will say that is an position ( is for the next one). If, given a graph , the next player making a move does not have a strategy to win then is a position ( is for the previous one).

Remark 3. Not having a strategy to win means the other player has a strategy to win. This follows from the Sprague-Grundy Theorem; see [3, 4]. So, if is the starting graph and Player 1 will move first, then being an position means Player 1 has a strategy to win the game, but if is a position then Player 2 has a strategy to win the game.

Next we define our game, which we call Grim.

Definition 4. Given a graph , we define a legal move of Grim on by a player selecting and consequently deleting a vertex. When this vertex is deleted all edges adjacent to this vertex are also deleted, together with any other vertices (if any) that have become isolated because of the move.
The game starts with Player 1 moving first on a prearranged, starting position, graph (naturally, if had any isolated vertices these would be deleted before the first player can move). After that, the two players alternate turns, making legal moves on the follower that resulted from the previous player’s move. They play until all vertices have been deleted. We refer to the winner of the game or winner of the graph as the player who makes the last legal move.

Remark 5. Grim is a normal combinatorial two-player game. Given the nature of the game, we will also say it is a vertex deletion game.

Note that changing the starting graph may change the way Grim is played completely. So, in this article we are not just studying a specific game, but a family of games. This property is commonplace in the study of games played on graphs, of which there is a wide variety; see, for example, Node Kayles in [5] and [6], Connect-it [7], and Take Turn [8] and other similar games in [911].

Our interest in the subject of games played on graphs is due to the papers by Fukuyama (see [12, 13]), where he studies Nim on graphs.

Our study of Grim is split as follows. In Section 2 we look at weighted graphs and prove that an extension of Grim to these graphs is unnecessary, as the strategies that could be used to play Grim in weighted graphs are the same as those used to play Grim on certain unweighted graphs. In Section 3 we find winning strategies for when Grim is played on complete or complete multipartite graphs. In Section 4 we look at how certain symmetries in a graph could be exploited to guarantee a victory when Grim is played on such a graph. In Section 5 we study paths, cycles, and other related graphs by using Sprague-Grundy functions; in this way we discover an interesting connection between Grim played on paths and an open problem about Octal games. Finally, in Section 6 we consider random graphs in order to learn whether Player 1 has an overall better chance of winning at Grim.

2. Weighted Graphs

It is not unusual to wonder whether a game played on graphs could be extended to be played on graphs with weighted vertices, maybe by thinking about the vertices of the graph as heaps of chips/tokens that can be removed one at a time by players. Of course, this way of playing Grim is similar to the way Nim is played, and thus it has been considered in the past (e.g., [14]). In this section we prove that the natural variation of Grim on weighted graphs is nothing but regular Grim on a different family of graphs.

When playing Grim on a weighted graph, we only allow a vertex with weight to be deleted after it has been selected times or if it has been completely isolated. Thus, we can create many different games from the same graph by giving each vertex a new random weight.

As we studied these graphs, we discovered that we could replace a vertex with weight with “regular” vertices that do not share any edges. In order to prove such a claim the concept of a blowup of a vertex becomes necessary.

Definition 6. Let be a graph with weighted vertices. Let having weight one and . A -blowup of is an independent set of vertices of weight that “takes the place” of . More precisely, wherever there was an edge joining to there is an edge joining with , for all .
The graph obtained by the -blowup of will be denoted as . Similarly, for and we denote a “double blowup” as . For multiple blowups we extend in the natural way the notation set of double blowups.

Note that , for all .

Lemma 7. Let . Let be a graph with weighted vertices, and let have weight . We denote by the -blowup of the graph obtained by reducing the weight of to one. Then, the outcome of playing Grim on or on is the same.

Proof. Let be the independent set used to obtain . There are two possible ways to delete while playing on ; thus we look at the following two cases.
Case . Try to isolate in . Using the same moves needed to remove all of ’s neighbors in we can isolate every vertex in (in ).
Case . Remove in by repeatedly using it in the game. In order to remove from , it has to be selected times. To fully remove from , each of the vertices in must be selected and removed. Thus removing from requires an equivalent process as that needed to remove from .
Therefore, game play with or with will involve the same strategies. Finally, replacing with will not affect the other vertices in the graph, and thus it will not affect playing with them.

An easy induction argument proves the main theorem of this section.

Theorem 8. Let be a weighted graph with and with being the weight of vertex , for all . We denote by the -blowup of the graph obtained by reducing (if possible) the weight of each vertex of to one. Then, the outcome of playing Grim on or on is the same.

We conclude that Grim on weighted graphs does not need to be studied separately, and so from now on the game discussed is always Grim played on unweighted graphs.

Before we move on, we would like to let the reader know that we will often use the word graph to mean the game played on that graph (as in “Player 1 wins graph ”). Most proofs in the following sections somehow describe the specific strategy to be used to win.

3. Complete and Complete Multipartite Graphs

In this section we obtain specific strategies to win at Grim for complete graphs and complete multipartite graphs. We start with a theorem about complete graphs.

Lemma 9. Let . Then, is position if and only if is even.

Proof. The case is immediate, as no game is ever played. For , all moves are equivalent in a complete graph, and a move will always yield a complete graph, so the game always lasts moves.

Grim played on complete bipartite graphs will be analyzed next.

Theorem 10. Let . Then, the following hold. (1) is an position.(2)Assume . Then, is an position if and only if is odd.

Proof. The first claim is immediate. For the second claim we start by settling a base case.
For , whatever move Player 1 makes, the follower is always . By part 1, Player 2 wins this graph.
Now we proceed by induction on . Part 1 and the base case considered above tell us that we have the result for . So, assume the result holds for . Consider , where .
Case . If is odd, then . WLOG assume that and let Player 1 move by creating the follower . Since both we use the induction hypothesis to determine that Player 1 wins .
Case . If is even, then . If WLOG then Player 1 would not want to move to create the follower , as this would be won by Player 2. However, if they moved to create the follower then they would lose anyway, by induction, as . Now, if then whatever move Player 1 makes they would lose by induction, as .

In the rest of this section we extend Theorem 10 to most multipartite graphs. At this point we would like to remark that the only way to delete a vertex in a complete multipartite graph and, by doing so, isolate other vertices would be when we were making a move on , which is a graph already studied in Theorem 10. This unique situation indicates that we should take a closer look at graphs that may have as a follower; is the only one of those graphs that has not been already studied in Theorem 10. Looking at the behavior of we obtained our next result.

Lemma 11. Let , and . Then, (1)if , then is an position if and only if is even.(2)If and , then is an position.(3)If , then is an position if and only if is even.

Proof. We start by noticing that the case is immediate. We will prove the case , by induction on . Our base cases are and . We know that the first graph is a position, and, clearly, Player 1 wins by leaving the follower after their first move. For , Player 1 should start by leaving as a follower (otherwise Player 2 would win the game immediately). Player 2 could leave or as a follower. In the first case, Player 1 wins , and in the second case induction forces the result we wanted.
Let us assume that and . If is even then Player 1 leaves as a follower, which by Theorem 10 is won by Player 1. If is odd then Player 1 leaves as a follower, and thus they win by using the strategy discussed above.
Finally, assume . Since none of the players would like to leave as a follower then the winners of these graphs will alternate depending on being even or odd. Thus we look at the “base case” , which is an position by Theorem 10, to get the desired result.

The complete tripartite graphs “missing” from Lemma 11 and most of the other complete multipartite graphs are considered in the following theorem.

Theorem 12. Let , where and , for all . Then, is a position if and only if is even.

Proof. Let , where and , for all . We define .
Suppose that is even and , for all . Note that is either or even.
Case . Consider ; that is, each partition of contains an even number of vertices. The strategy for Player 2 is as follows: the game starts with Player 1 deleting any vertex from the graph. Since the partition where this vertex was will have at least one more vertex in it, Player 2 deletes a vertex in it. In this way, Player 2 always has an available move in the same partition that Player 1 has chosen to play on. Hence, Player 2 is always the last person to delete a vertex from every partition of , and thus they will always have the last move in the game, as they will be the only person able to play in the state , when that time comes.
Case . Consider , for some nonzero . Now the strategy for Player 2 is twofold: if Player 1 moves in an “even” partition of then Player 2 follows the strategy in Case , but if Player 1 deletes a vertex in an “odd” partition then Player 2 deletes a vertex in one of the other odd partitions (there would be an odd number of them available). Note that after one move by each player, the follower obtained would be either a graph that Case considers or that would have , and thus an induction argument would finish the proof. Note that the base case(s) of this induction could be tracked down to knowing who wins or , which are both positions by Theorem 10.
Now suppose that is odd and , for all . Since there must be some , the strategy for Player 1 is to delete any vertex in a partition with an odd number of vertices. In this way, they would leave a follower with an even number of vertices that also has every partition containing more than vertex. For this follower, Player 1 will move second and thus will win the graph.

We now look at a specific family of multipartite graphs allowing singletons as partitions.

Lemma 13. Let , where , , and , for all . Then, is a position if and only if is even and , for all .

Proof. If is odd then Player 1 leaves as a follower, which is a position (by Theorem 12), and thus Player 1 wins . Now, if is even then Player 1 would not want to leave as a follower, as in this case, by Theorem 12, Player 2 would win . Hence, Player 1 would leave WLOG as a follower. If then by the previous case we would get that Player 2 wins . If we allow of to be equal to then, after rearrangement if needed, we get , where . Note that because is even. In this case, Player 1 leaves as a follower, and thus Player 1 wins using the strategy discussed for the case odd.

There are several complete multipartite graphs that we have not studied and we will not study in this paper; these, after a rearrangement if needed, have the form , where , , and , for all . Some of them may be studied very easily; for example, is a position if and only if is odd. The conditions needed to understand others are much more complex. For instance, if and , then is a position if and only if and have different parity.

On the other hand, in order to understand the case we need to look at these two parameters and also to how much bigger than the quantity is.

Also, unlike most of the graphs studied in this section, and are always won by Player 1 independent of the parity of . This situation is not that uncommon in the graphs we have not studied here; for instance, the family of graphs of the form , for , are also won by Player 1 by leaving the follower for even and for odd. There are several other families, similar to , that may be proven to be won by Player 1 only.

All of this suggests that a complete theory of how Grim would play on multipartite graphs allowing singletons as partitions is very complex, and thus we plan to study it separately in a future article.

Other “standard” families of graphs can be studied in a similar fashion to what has been done in this section with complete and complete multipartite graphs. However, as it was seen in this section and we will see again in Section 5, the analysis of Grim gains complexity quickly. Hence, in the following sections we will study Grim on graphs by using a less direct set of techniques.

4. Automorphisms

Certain symmetries in a graph can be exploited to obtain strategies for winning at Grim. In this section we prove a couple of results of this type, and then we apply them to a few families of graphs.

Definition 14. A function is said to be an automorphism of a graph if permutes the vertices of while preserving incidence. The group (under composition) of all the automorphisms of is denoted as .

Theorem 15. Let be a graph, and assume that has an element of order such that and , for all . Then, is a position.

Proof. Let be such that and , for all . We will prove that if Player 1 moves by selecting a vertex , then Player 2 can always move by selecting .
We will proceed by contradiction. Suppose that at a certain stage of the game and for the first time, Player 1 moves by selecting a vertex leaving a follower that does not contain . If was already deleted when Player 1 made their move, then either was deleted by Player 2, which would contradict that had not been deleted at this point, or was deleted by becoming isolated, which would force (as ) to be isolated. In either case, the situation is impossible. So, the only option would be that gets isolated at the time of deleting . But and are not adjacent, so deleting cannot isolate .

Corollary 16. Let be a graph with no isolated vertices, and assume that has an element of order such that , for exactly one , and , for all . Then, is an position.

Proof. Player 1 starts the game by deleting , leaving a follower that is a position by Theorem 15. Hence, is an position.

The following corollary summarizes a few applications of Theorem 15 and Corollary 16.

Corollary 17. Let . (1)If is odd and , then is an position.(2)If is even and , then is a position.(3)If is odd and , then is an position.(4) is a position, for all nonempty graphs .

Proof. (1) Use Corollary 16 with the reflection across the middle vertex of .
(2) Model with a regular -gon. Use Theorem 15 with defined by reflecting every vertex across the center of the polygon.
(3) Use the same function in the proof of (2), but now apply Corollary 16, as the center of the wheel is fixed.
(4) Use Theorem 15 with the identification between the two copies of .

Theorem 15 and Corollary 16 can also be used in the study of Cartesian products of graphs.

Definition 18. Let and be two disjoint graphs. The Cartesian product of and , denoted as , is defined by and edges given by the following:(1) is adjacent to if and and are adjacent in ;(2) is adjacent to if and and are adjacent in , where and .

Corollary 19. Let , be graphs and . (1)If satisfy the hypothesis in Theorem 15, then, is a position.(2) If satisfy the hypothesis in Corollary 16, then is an position.

Proof. (1) Let be the automorphism satisfying the hypothesis in Theorem 15. It is easy to see that defined byis an automorphism of also satisfying the hypothesis in Theorem 15. The result follows.
The proof for (2) uses the very same ideas, so we omit it.

An attempt to find strategies that allow us to determine who would win , for arbitrary graphs and , was made but it failed because we realized that keeping track of all the possible avenues the game could take was an impossible task. A natural approach to how to “keep track” of what happens in a game is discussed in the following section.

5. The Sprague-Grundy Function

One of the most useful tools in the study of combinatorial games is the Sprague-Grundy function. We proceed to define it, in the context of Grim, and then we focus our efforts on finding its values for paths.

Definition 20. Let and be a graph. We define to be the set of all followers of (in the game Grim). The Sprague-Grundy function of is a function , defined recursively as follows:If we define the minimal excludant or mex of a set of nonnegative integers as the smallest nonnegative integer not in the set, then we may write

Remark 21. if and only if is a position.

The process to calculate the Sprague-Grundy values by hand is laborious, so we wrote a program in Visual FoxPro to compute the Sprague-Grundy value of Grim on paths. We focused on paths because in Corollary 17 we learned that odd paths are positions, but when wanting to look at even paths no pattern seemed to exist.

Using our program, we were able to compute all the values of (a library of these values may be obtained at http://www.gamecalledgrim.com) for up to . Using these results we know that if , then only whenwhich is something Lącko and Lącki (in unpublished work; see [15]) had also determined (although they consider as position while we do not consider as graph where we would play Grim, as all isolated vertices in a graph are deleted before a game starts). Moreover, they also claim that for all values in the range . The obvious question, at this point, is whether or not there are any other even paths with . It turns out that the answer to this question is related to a different open problem in game theory.

Definition 22. An Octal game is a normal impartial game played on heaps of chips. A move consists of taking a number of chips from a single heap, eliminating them, and then redistributing the remaining chips in the heap (if any left) into 0 (all chips in the heap were eliminated), 1 (leave the remaining chips intact), or 2 heaps; this number is fixed in advance for the game and depends only on how many chips were eliminated in the move. Given that there are several variables to determine at the beginning of the game, the rules of the game are encoded into a string of digits as follows.
If in a move we remove chips from a heap and we are allowed to break the remaining ones into heaps then we say that . In the case that we were not allowed to break the remaining ones into heaps we say that . The code of the game is , whereIt follows that since , the game Octal.6 is a game in which every move consists of one chip being removed from a heap and what remains of that heap must be left in exactly 1 or 2 nonempty heaps.
Several Octal games have Sprague-Grundy sequences that after a while become periodic (see [16], e.g.); it is not known whether Octal. has a period. This is relevant to us because the terms in the sequences of Sprague-Grundy numbers for Grim on paths and Octal. are the same (see Theorem 23 below). Thus our question about values of for which becomes a problem about when Octal. is won by Player 2, which is an open problem (e.g., see [17]).
In order to create some intuition on the reader about our next result, we notice that we can identify removing a chip from a heap in Octal. with deleting a vertex in a path (under Grim rules). More explicitly, depending on what vertex we delete, we always leave one or two paths left; these two paths would be the equivalent of the two heaps left after removing a chip in Octal..

Theorem 23. The Sprague-Grundy sequence of values of Grim played on paths is equivalent to the Sprague-Grundy sequence of values of Octal..

Proof. Let , be Octal. played on a heap of size and be Grim played on a path on vertices. We will prove that . We will do this by induction on .
For we get that both games are trivial and thus . We now assume that , for all .
First we notice that the followers of and are Using Nim Sum (see [2]), denoted as below, to evaluate the Sprague-Grundy number of the followers of and , we getUsing the inductive hypothesis and Nim Sum we get that Hence, .

If we knew all the values in the sequence we would also know several other Sprague-Grundy sequences. We present two results of this type, without a proof, in the following corollaries.

Corollary 24. The Sprague-Grundy sequence for Grim on cycles is given byIn particular, is a position when is even.

Finally, we get a result about wheels that depends on whatever knowledge we had about paths.

Definition 25. A wheel graph on vertices is defined by . is called the center of the wheel.

Corollary 26. Let ; then is an position if and only if is an position.

Proof. has only two followers: , obtained from deleting the center of the wheel and , obtained by deleting a vertex different from the center of .
If Player 1 wins , then they can win by removing the center vertex and leaving as a follower; this then forces Player 2 to leave as a follower, which is an position.
If Player 2 wins , then since has only two followers and both of them are one deleted vertex away from , Player 2 can leave as a follower after their first move.

6. Grim on Random Graphs

We are interested in understanding what happens when Grim is played on a random graph. Our main reason is that evidence in previous sections has shown that the game seems to favor Player 1 overall. In order to do this, we will use Erdős-Rényi random graphs.

Definition 27. Let and . An Erdős-Rényi random graph is defined by having vertices and, for any pair of vertices, the existence of an edge connecting them has probability .
In this section, we will work on identifying probabilities for which Player 1 and Player 2 have equal chances of winning a random graph .

Remark 28. The probability of any given graph on vertices and edges to exist is given by . So, if , then all possible graphs on vertices have equal probability to exist, this value being .

Definition 29. The winning probability of Player 1, denoted as , is a function that describes the probability for Player 1 to win on a random graph, for a fixed and a given edge probability . It is of the form where the sum runs through all graphs (including the empty graph, which is a position), for a graph on edges, and

The winning probability of Player 2, denoted by , may be defined similarly.

As an illustration, let us consider Erdős-Rényi random graphs on vertices with edges generated with probability . We know that there are eight -vertex graphs. Out of these eight graphs, Player 1 would win all the three graphs with one edge and all the three graphs with 2 edges and lose the one complete graph and the empty graph. Hence, the winning probabilities are

Note that setting yields the quadratic equation , which has solutionsthey are approximately and .

Thus, Player 1 and Player 2 have an equal chance of winning on a 3-vertex graph if the chance of each edge appearing is about or . Moreover, looking at the graph of we get that Player 2 has more than a chance of winning as long as

On the other hand, if we now consider Erdős-Rényi random graphs on vertices, we get that the winning probability for Player 2 iswhich is equal to for and always below after.

Our examples suggest the following theorem.

Theorem 30. Let be odd. For Erdős-Rényi random graph , there exists such that , for all .

Proof. We will get a lower bound for and use it to derive the existence of . Note that, by Remark 28, we getWe set this bound equal to 0.5 and solve for . We get the solution which is in , for every .
Since implies , we get that , for all .

Notice that as the number of vertices gets large, the bound for the value of given in the proof of Theorem 30 approaches and thus, overall, Player 1 has increasingly better chances to win. It would be good to find an explicit expression for the least possible , but this seems to be a really hard problem, as we do not know which graphs are positions.

Competing Interests

The authors declare that there is no conflict of interests regarding the publication of this article.


The study was partially supported by the National Science Foundation Grant DMS-1247679.