{'fraction_non_alphanumeric': 0.029232872837003158, 'fraction_numerical': 0.009854307133763968, 'mean_word_length': 4.565468381002361, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
The game of go as a complex network

We study the game of go from a complex network perspective. We construct a directed network using a suitable definition of tactical moves including local patterns, and study this network for different datasets of professional tournaments and amateur games. The move distribution follows Zipf's law and the network is scale free, with statistical peculiarities different from other real directed networks, such as e. g. the World Wide Web. These specificities reflect in the outcome of ranking algorithms applied to it. The fine study of the eigenvalues and eigenvectors of matrices used by the ranking algorithms singles out certain strategic situations. Our results should pave the way to a better modelization of board games and other types of human strategic scheming.

Introduction. -The study of complex networks has attracted increasing interest in the past decade, fueled in particular by the great recent development of communication and information networks. Tools and models have been created, enabling to describe the growth mechanisms and properties of such systems. In parallel, it has been realized that many important aspects of the physical world or of social interactions can be modelized by such networks. Such tools have been applied to many fields of human activity, such as e.g. languages or friendships [1].
One of the oldest activities of human beings, board games have been played for millenia. Besides their intrinsic interest, they represent a privileged approach to the working of decision-making in the human brain. Some of them are very difficult to modelize or simulate: only recently were computer programs able to beat world chess champions. The old Asian game of go is even less tractable. The game complexity, that is, the total number of legal positions, is about 10 171 , compared to a mere 10 50 for chess [2]. It remains an open challenge for computer scientists: while Deep Blue famously beat the world chess champion Kasparov in 1997, no computer program has beaten a very good player even in recent times.
Many studies have been devoted to "computer go", the simulation of the go game on a computer. They were historically based on deterministic tree search algorithms such as minimax or alpha-beta, which estimate an evaluation function (giving the game-theoretic value of a move) on the tree of allowed moves (see e. g. [3,4]). Recently, much progress has been done by introducing Monte-Carlo techniques [5,6], which basically estimate the value of a move by playing subsequent moves at random according to the rules of go. Monte-Carlo tree search algorithms are based on a non-uniform probability distribution over legal moves, and explore only the most promising ones. Variations on these techniques allowed computer programs to make significant progress in the last few years, so that professional human players with a large enough handicap could be beaten by a computer [7]. The choice of the evaluation function and the way in which the tree is explored are crucial ingredients for any further progress.
Since go is a popular game with millions of players in the world, many games have been recorded, which enables statistical data to be extracted reliably. A few works have used statistical properties of recorded professional games to optimize performances of Monte-Carlo algorithms. Usually the simplest features of real games are retained, such as local patterns or contiguity to the previous move [8]; including more real-game features improves noticeably the winning rate of computer programs [9].
In this paper, we thus study the game of go from a complex network perspective. We use databases of expert games in order to construct networks from the different sequences of moves, and study the properties of these networks. We based our numerical results on the whole available record, from 1941 onwards, of the most important hisp-1 torical professional Japanese go tournaments: Kisei (143 games), Meijin (259 games), Honinbo (305 games), Judan (158 games) [10]. To increase statistics and compare with professional tournaments, 4000 amateur games also available from [10] were used.
Definition of inequivalent moves. -The game of go is played by two players (Black and White) on a board (goban) consisting of 19 horizontal and 19 vertical lines. The players alternately place a stone of their own color at an empty intersection on the board. Stones entirely surrounded by the opponent must be removed, and the aim of the game is to delimit large territories. As the game unfolds, local and global properties of stones are involved. A network approach will obviously not be able to capture all features of the game, as the number of possible moves is far too large. Here we follow an approach where only local features are retained. This approach is reminiscent of the one used in the context of language networks [11].
A move consists in placing a stone at an empty intersection (h, v) with 1 ≤ h, v ≤ 19. We call "plaquette" a square of 3 × 3 intersections, that is, a subset of the board of the form {(h + r, v + s), −1 ≤ r, s ≤ 1} (to account for edges and corners of the board one can imagine that there are two additional dummy lines at each side of the board). To define our network we only take into account intersections closest to (h, v). Vertices correspond to the different kinds of plaquettes in which a player can put a stone, irrespective of where it has been played on the board. Since each of the 8 neighboring intersections can be either empty, black or white, there are ∼ 3 8 different plaquettes. We choose to consider identical plaquettes that transform to each other under any symmetry of the square (rotation or flip). We also identify patterns with color swapped. That is, a move where Black plays in a given plaquette is considered the same as a move where White plays in the same plaquette with colors swapped. An exact computation taking into account borders and symmetries leaves us with 1107 nonequivalent plaquettes with empty centers, which are the vertices of our network. We note that certain computer programs based on knowledge from real professional games also consider similar 3 × 3 stone patterns [8,9]. Considering larger plaquettes is possible and would convey more relevant information; however, the number of vertices then becomes enormously large (≈ 3.10 10 for 5 × 5 plaquettes).
This definition of inequivalent moves enables us to investigate the first properties of the databases in term of frequencies of moves. Zipf's law is an empirical characteristics which has been observed in many natural distributions, such as e. g. word frequency in the English language [12], city sizes [13], income distribution of companies [14], and chess openings [15]. If items are ranked according to their frequency, it predicts a power-law decay of the frequency as a function of the rank. Zipf's law was observed in the frequency distribution of 5 × 5 go patterns [16]. In Fig. 1 we display the integrated frequency distribution for our 1107 moves labeled from the most to the least frequent. The integrated distribution of moves is very similar for all databases and clearly follows a Zipf's law, with an exponent ≈ 1.06. In contrast, such a law cannot be seen if one simply takes the 361 possible positions (h, v) as vertices, disregarding local features (inset of Fig. 1). Thus Zipf's law appears when tactical information is taken into account. For all databases the 10 most frequent moves are the same (see Fig. 9, upper line), but sometimes in a slightly different order.  the vicinity of their opponent's stones to engage the battle, but the opponent might prefer to first continue a fight occurring somewhere else, in which case two consecutive moves would not be directly related. In order to construct our network, it is thus natural to connect two moves by a directed link only if these moves follow each other in the same region of the board. To be more specific, we connect vertices corresponding to moves a and b played at Each choice of the integer d defines a different network. The choice of d determines the distance beyond which two moves are considered nonrelated. We present in Fig. 2 the frequency distribution for sequences of moves defined in such a way with d = 4. We observe an algebraic decrease with exponent ranging from ≈ 1 for short sequences to ≈ 0.8 for longer sequences. Thus sequences of moves follow Zipf's law, as was observed for word sequences in languages [11]. We attribute the decrease of the exponent to the fact that longer sequences reflect more and more individual strategies. As a comparison, Fig. 3 displays the frequency distribution of successive moves for three other definitions of moves and sequences of moves. In cases C1 and C2, moves are defined as positions (h, v) on the board, disregarding local features, and b is considered to follow a if b is played immediately after a (case C1) or if b is the first move played after a and in the vicinity of a, with d = 4 (case C2); in case C3 sequences of vectors between two moves played in the same region (with d = 4) are considered. These results indicate that move sequences, even long ones, are best hierarchized by our initial definition. In what follows we will thus disregard other choices C1-C3. In the inset of Fig. 3, we also show the distribution P (d) of distances between consec-utive moves. Interestingly enough, the amateur database departs significantly from all the professional ones, with a tendency to play more often at shorter distances. This may reflect the fact that professionals are more prone to play several tactical fights in parallel, or play on average shorter local tactical fights. We now investigate the properties of our networks. We construct a network for each database by playing the games according to the rules of go and adding directed links between the 1107 vertices as indicated above. To each link is assigned a weight given by the number of occurrences in the database.  The distribution of ingoing and outgoing links P in and P out is displayed in Fig. 4. The tails of both distributions are very close to a power-law 1/k γ with exponent γ = 1.0 for the integrated distribution. The results are stable in the sense that the exponent does not depend on the database considered. The presence of such power laws indicates that the network displays the scale-free property: the distribution of links around a given link frequency is independent of that frequency. Such a property has been seen in many social or biological networks, but is absent in e.g. the famous Erdös-Renyi model of random networks. The symmetry between ingoing and outgoing links is a peculiarity of this network; it is well known for the World Wide Web (WWW) for example that the exponent for P out (γ ≈ 1.7) is much larger than for P in (γ ≈ 1.1) [17]. In the case of the WWW, the number of outgoing links is limited by the behavior of each independent webmaster. In our case, the results indicate a symmetry, at least at a statistical level, between moves that often follow others and moves which have many possible following moves.

p-3
This may correspond to the fact that many short tactical sequences can be played in a different order within several different contexts. In order to analyze the dependence of P in and P out on the choice of d, we plot these quantities for a network constructed for various values of d in the inset of Fig. 4. The distribution of ingoing and outgoing links stabilizes at d = 4. Other databases give similar results (data not shown). We now focus on d = 4.
Some properties can be extracted from the unweighted adjacency matrix (i. e. without weighing the links according to their frequency). The clustering coefficient (CC) describes the tendency of many real-world networks to form local clusters of highly connected vertices. The CC of a given vertex i is defined as the probability that two neighbors of i be connected to each other, irrespective of the direction of the link. The average CC for our networks is displayed in Fig. 5 (inset). The CC depends on the number of games n g included to construct the network, but almost not on the database. For large n g , the CC goes to an asymptotic value which appears to be larger than 0.7, indicating high clustering, larger than the WWW (where the CC is ≈ 0.11 [1]) and comparable to social [1] or language networks [11]. Ranking vectors for the go network. -In order to get an insight into how our network captures aspects of the strategy of the game, we now use the weighted adjacency matrix (links are weighted according to their frequency in the database) and apply tools developed to rank vertices in order of importance, used e.g. to determine the order of appearance of answers to queries by search engines. These methods generally build a ranking vector, whose value on each vertex enables to determine its im-portance. The most famous such vector is the PageRank vector [18,19], which was the basis of the Google search engine. It is built from the Google matrix G, defined as G ij = αS ij +(1−α) t ee/N , where e = (1, ..., 1), N = 1107, 0 < α ≤ 1, S is the weighted adjacency matrix with any column of 0 replaced by a column of 1, and the sum of each column normalized to 1. The PageRank vector is the right eigenvector of G associated with the largest eigenvalue λ = 1, and singles out vertices with many incoming links from important nodes. From its definition, its components are real and nonnegative, and therefore can be used to rank nodes according to the value of these components. Other ranking vectors built from G include the CheiRank vector [20] (which is the PageRank of the network with all links inverted), and the Hubs and Authorities of the HITS algorithm [21]. They all share the properties of being real nonnegative vectors, and thus can be used to rank the nodes of the network. While PageRanks and Hubs reflect properties of vertices depending on their incoming links, CheiRanks and Authorities are based on outgoing links. In Fig. 5 we show these ranking vectors for our networks. They follow an algebraic law with slope ≈ −1 (PageRank and CheiRank) and ≈ −1.5 (Hubs and Authorities). A similar distribution of the PageRank was observed in e.g. the WWW [17,22], but in contrast with the WWW and other systems there is a marked symmetry between distributions of ranking vectors based on ingoing links and those of vectors based on outgoing links. In order to further shed light on this symmetry, we plot in Fig. 6 the correlation between the PageRank and the CheiRank for the five databases considered. In all these cases, there is a remarkably strong correlation between these rankings based respectively upon ingoing and outgoing links. In the WWW, there is a difference of nature between ingoing and outgoing links: webmasters are free p-4 to create as many outgoing links as they wish from their webpage, whereas the ingoing links depend on the cumulative effect of all other webmaster behaviors. In contrast, for the go network, the fact that a link is ingoing or outgoing depends on the chronological order in which the moves are played. The results displayed in Fig. 6 thus seem to indicate that there is a strong correlation between moves which open many possibilities of new moves and moves that can follow many other moves. However, the symmetry is far from exact, as can be seen in Fig. 6.
Although there is always some correlation between the different ranking vectors, they usually can be quite different, for example in Wikipedia articles [20]. A recent analysis of the world trade network [23] showed such a symmetry when all commodities were aggregated, but the symmetry was much less visible when each different commodity was treated separately. It is possible that in our case the symmetry is made more prominent by our definition of moves through 3 × 3 plaquettes. A more refined approach with larger plaquettes may thus disambiguate the moves and give different results. We nevertheless think that our result indicate a specific feature of the game, such as the existence of many short sequences of tactical moves which can be played at different moments of the game. Eigenvectors of the Google matrix. -As can be seen in Fig. 5, the ranking vectors are distributed according to power laws and thus are mainly localized on few vertices, mainly the most frequent ones according to Zipf's law (see e. g. Fig. 9, upper line). However, these ranking vectors correspond to the eigenvector associated with the largest eigenvalue of different matrices built from the network. We now consider the other eigenvectors of G. In particular, the eigenvectors associated with next to lead-ing eigenvalues can describe specific communities inside the network [22]. The distribution of eigenvalues is also important, as it reflects the structure of the network [22]. Fig. 7 shows the complex eigenvalues of the matrix G. For the WWW a sizable fraction of eigenvalues are close to zero, while the remaining ones are spread inside the unit circle, with no gap between the first eigenvalue and the bulk [22]. By contrast, in the case of the go network, there is a huge gap between the first eigenvalue λ = 1 and the next ones. This is reminiscent of what can be seen in some lexical networks [22]. Such features indicate that the network is well-connected, with few isolated communities, and is consistent with the finding of a high clustering coefficient (see inset of Fig. 5). Whereas the WWW contains many communities of webpages which are almost cut off from the rest of the network, this is not the case for the go network, where communities -i.e. sequences of tactical moves preferentially played together -have more connections to the rest of the network, indicating that tactical moves can belong to different strategic groupings. To put these data in perspective, we have constructed a random version of the network, by randomly shuffling the moves inside each game of the databases. This process conserves Zipf's law and the global characteristics, but eigenvalues of G are all concentrated in the bulk (data not shown), in contrast with the real go network, indicating that communities are destroyed by the randomization process. In Fig. 7 (bottom), it is shown that the radius of the bulk of eigenvalues changes with the number of games n g entered in the network. This indicates that as more games are taken into account, rare links appear which break more and more the weakly coupled communities. The next to leading eigenvalues are important, as they in- dicate the presence of communities of moves which have common features. The distribution of the first 7 eigenvectors (Fig. 8) shows that they are concentrated on particular sets of moves different for each vector. The corresponding moves are displayed in Fig. 9 for the Honinbo database. The first eigenvector is mainly localized on the most frequent moves. By contrast, the third one is localized on moves describing captures of the opponent's stones, and part of them single out the well-known situation of ko ("eternity"), where players repeat captures alternately. The 7th eigenvector singles out moves which appear to protect an isolated stone by connecting it with a chain. These eigenvectors are different for different tournaments and from professional to amateur. Indeed, the inset of Fig. 9 shows the distribution of the first seven eigenvectors for amateur database, very different from the one for Honinbo. It also shows for comparison the distribution for the randomized network (see above), which is much less peaked. Systematic studies of these eigenvectors, as well as the frequency of sequences of moves, should enable to group together certain moves, and should help to elaborate efficient go simulators.
Conclusion. -In this paper, we have studied the game of go, one of the most ancient and complex board games, from a complex network perspective. We have defined a proper categorization of moves taking into account the local environment, and shown that in this case Zipf's law emerges from data taken from different tournaments. The network of go moves has some peculiarities, such as a statistical symmetry between ingoing and outgoing links distributions, which reflects itself in a symmetry between rankings based on ingoing on outgoing links, a feature not seen in many other complex directed networks such as the WWW. Differences between professional tournaments and amateur games can be seen. Properties of eigenvalues and eigenvectors of the matrices producing ranking vectors vary between amateur and different professional tournaments. Certain eigenvectors are localized on specific groups of moves which correspond to different strategies. We think that the point of view developed in this paper should allow to better modelize such games and could also help to design simulators which could in the future beat good human players. Our approach could be used for other types of games, and in parallel shed light on the human decision making process.
We thank CalMiP for the use of their supercomputers, and D. Shepelyansky for useful discussions.