# Playing Ticket-to-Ride like a computer programmer

Applying graph theory and network analysis in building effective strategies for playing a board game. Ticket-to-ride is one of the very few strategic board games and it requires that players need a lot of planning and strategy building in the process. With the simple application of network analysis and graph theory concepts, it is possible that one can play this game even more efficiently. In this article, I will share some of my results from the computational analysis on the Ticket-to-ride board game. Also, I will discuss how to build the best strategies for this game

Ticket-to-ride is one of the very few strategic board games and it requires that players need a lot of planning and strategy building in the process. With the simple application of network analysis and graph theory concepts, it is possible that one can play this game even more efficiently. In this article, I will share some of my results from the computational analysis on the Ticket-to-ride board game. Also, I will discuss how to build the best strategies for this game.

### Building the structure

We will be using the popular python package `[networkx](https://networkx.github.io/)` to build the graph structures. To fit in the current context, cities are represented as nodes and segments between cities can be represented as edges. Then we construct the network using the below code.

Once the network is constructed, we can quickly see the basic info using the code below.

It can be noted from above that the network has 47 cities (nodes) and 90 tracks (edges).

### Basic Stats

In network theory, the degree of a node is the number of edges that it is connected to, which translates to the number of tracks that a city is connected to. Based on a degree distribution chart shown below (Fig-1), it can be observed that the degree of all cities ranges between 1–7. About 15 cities have a degree of 4 and 14 cities have a degree of 3. There is only one city with a maximum degree of 7 and two cities with a degree of 6.

## Data Science With Python Training | Python Data Science Course | Intellipaat

🔵 Intellipaat Data Science with Python course: https://intellipaat.com/python-for-data-science-training/In this Data Science With Python Training video, you...

## Python for Data Science | Data Science With Python | Python Data Science Tutorial

🔥Intellipaat Python for Data Science Course: https://intellipaat.com/python-for-data-science-training/In this python for data science video you will learn e...

## Applied Data Science with Python Certification Training Course -IgmGuru

Master Applied Data Science with Python and get noticed by the top Hiring Companies with IgmGuru's Data Science with Python Certification Program. Enroll Now

## Python For Data Science | Python For Data Analysis

Python for Data Science, you will be working on an end-to-end case study to understand different stages in the data science life cycle. This will mostly deal with "data manipulation" with pandas and "data visualization" with seaborn. After this, an ML model will be built on the dataset to get predictions. You will learn about the basics of the sci-kit-learn library to implement the machine learning algorithm.

## 50 Data Science Jobs That Opened Just Last Week

Data Science and Analytics market evolves to adapt to the constantly changing economic and business environments. Our latest survey report suggests that as the overall Data Science and Analytics market evolves to adapt to the constantly changing economic and business environments, data scientists and AI practitioners should be aware of the skills and tools that the broader community is working on. A good grip in these skills will further help data science enthusiasts to get the best jobs that various industries in their data science functions are offering.