You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17275 lines
4.4 MiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"%load_ext autoreload\n",
"%autoreload 2\n",
"\n",
2 years ago
"import time\n",
"import geopandas as gpd\n",
2 years ago
"from utils import *\n",
"\n",
"# ignore warnings\n",
"import warnings\n",
"warnings.filterwarnings(\"ignore\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Table of contents**<a id='toc0_'></a> \n",
"- [Aim of the project](#toc1_1_) \n",
"- [Introduction: theoretical background](#toc2_) \n",
" - [Definition of a random graph](#toc2_1_) \n",
" - [ Erdős-Rényi graphs](#toc2_2_) \n",
" - [Scale-free networks](#toc2_3_) \n",
" - [Diameter and fractal dimension (infinite-dimensional networks)](#toc2_3_1_) \n",
" - [Watts-Strogatz model](#toc2_4_) \n",
" - [Random graphs as a model of real networks](#toc2_5_) \n",
"- [Discovering the datasets](#toc3_) \n",
" - [Brightkite](#toc3_1_1_) \n",
" - [Gowalla](#toc3_1_2_) \n",
" - [Foursquare](#toc3_1_3_) \n",
" - [Building the networks](#toc3_2_) \n",
" - [Check-ins networks](#toc3_2_1_) \n",
" - [Friendship network](#toc3_2_2_) \n",
"- [Properties of the networks](#toc4_) \n",
" - [Average Degree](#toc4_1_) \n",
" - [Clustering coefficient](#toc4_2_) \n",
" - [Average Path Length](#toc4_3_) \n",
" - [Betweenness Centrality](#toc4_4_) \n",
" - [Download the dataframe with accurate results](#toc4_5_) \n",
"- [Analysis of the results](#toc5_) \n",
" - [Distribution of Degree](#toc5_1_1_) \n",
" - [The Small-World Model](#toc5_2_) \n",
" - [Small-Worldness](#toc5_3_) \n",
" - [Identifying small-world networks](#toc5_4_) \n",
" - [A first approach: the $\\sigma$ coefficient](#toc5_4_1_) \n",
" - [A more solid approach: the $\\omega$ coefficient](#toc5_4_2_) \n",
" - [Lattice network construction](#toc5_4_2_1_) \n",
" - [Limitations](#toc5_4_2_2_) \n",
" - [Omega coefficient computation: standard procedure](#toc5_4_3_) \n",
" - [Omega coefficient computation: parallelization approach (experimental)](#toc5_4_4_) \n",
" - [Why experimental?](#toc5_4_4_1_) \n",
" - [Are our networks small-world?](#toc5_5_) \n",
" - [Degree distribution](#toc5_6_) \n",
" - [Betweenness centrality](#toc5_7_) \n",
" - [Clustering coefficient](#toc5_8_) \n",
" - [Conclusions: the omega coefficient](#toc5_9_) \n",
"- [References](#toc6_) \n",
"\n",
"<!-- vscode-jupyter-toc-config\n",
"\tnumbering=false\n",
"\tanchor=true\n",
"\tflat=false\n",
"\tminLevel=1\n",
"\tmaxLevel=6\n",
"\t/vscode-jupyter-toc-config -->\n",
"<!-- THIS CELL WILL BE REPLACED ON TOC UPDATE. DO NOT WRITE YOUR TEXT IN THIS CELL -->"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## <a id='toc1_1_'></a>[Aim of the project](#toc0_)\n",
"\n",
"<!-- Given a social network, which of its nodes are more central? `[18]` This question has been asked many times in sociology, psychology and computer science, and a whole plethora of centrality measures (a.k.a. centrality indices, or rankings) were proposed to account for the importance of the nodes of a network. \n",
"\n",
"These networks, typically generated directly or indirectly by human activity and interaction (and therefore hereafter dubbed \"social\"), appear in a large variety of contexts and often exhibit a surprisingly similar structure. One of the most important notions that researchers have been trying to capture in such networks is “node centrality”: ideally, every node (often representing an individual) has some degree of influence or importance within the social domain under consideration, and one expects such importance to surface in the structure of the social network; centrality is a quantitative measure that aims at revealing the importance of a node.\n",
"\n",
2 years ago
"Among the types of centrality that have been considered in the literature, many have to do with distances between nodes. Take, for instance, a node in an undirected connected network: if the sum of distances to all other nodes is large, the node under consideration is peripheral; this is the starting point to define Bavelas's closeness centrality, which is the reciprocal of peripherality (i.e., the reciprocal of the sum of distances to all other nodes). \n",
"\n",
"The role played by shortest paths is justified by one of the most well-known features of complex networks, the so-called **small-world phenomenon**. A small-world network is a graph where the average distance between nodes is logarithmic in the size of the network, whereas the clustering coefficient is larger (that is, neighborhoods tend to be denser) than in a random Erdős-Rényi graph with the same size and average distance. The fact that social networks (whether electronically mediated or not) exhibit the small-world property is known at least since Milgram's famous experiment and is arguably the most popular of all features of complex networks. For instance, the average distance of the Facebook graph was recently established to be just $4.74$. -->\n",
2 years ago
"\n",
"This project aims to study the small-world phenomenon in the context of geographical social networks. We will consider a large number of centrality measures, and we will try to understand how the small-world phenomenon manifests itself in each of them. We will also try to understand how the small-world phenomenon is affected by the choice of centrality measure and how peculiar topologies of a network affects our results.\n",
2 years ago
"\n",
"Generally speaking, a small-world network is a graph where the average distance between nodes is logarithmic in the size of the network, whereas the clustering coefficient is larger (that is, neighborhoods tend to be denser) than in a random Erdős-Rényi graph with the same size and average distance. The fact that social networks (whether electronically mediated or not) exhibit the small-world property is known at least since Milgram's famous experiment and is arguably the most popular of all features of complex networks. For instance, the average distance of the Facebook graph was recently established to be just $4.74$."
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# <a id='toc2_'></a>[Introduction: theoretical background](#toc0_)\n",
"\n",
"Prior to the 1960s, graph theory primarily focused on the characteristics of individual graphs. In the 1960s, Paul Erdős and Alfred Rényi introduced a systematic approach to study random graphs, which involves analyzing a collection, or ensemble, of many different graphs. \n",
"\n",
"Each graph in the ensemble is assigned a probability, and a property is said to hold with probability $P$ if the total probability of the graphs in the ensemble possessing that property is $P$, or if the fraction of graphs in the ensemble with the property is $P$. This method allows for the application of probability theory in conjunction with discrete math to study ensembles of graphs. A property is considered to hold for a class of graphs if the fraction of graphs in the ensemble without the property has zero measure, which is typically referred to as being true for \"almost every\" graph in the ensemble. `[2]`"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## <a id='toc2_1_'></a>[Definition of a random graph](#toc0_)\n",
"\n",
"Let $E_{n,N}$ stand for the collection of graphs that have $n$ designated labeled vertices $V_1, V_2, \\dots, V_n$ and $N$ edges. The graphs in consideration are undirected, have no parallel edges and do not loop. Therefore, a graph within $E_{n,N}$ can be obtained by selecting $N$ from the $\\binom{n}{2}$ possible connections between $V_1, V_2, \\dots, V_n$. As a result, the cardinality of $E_{n,N}$ is calculated by the binomial coefficient $\\binom{\\binom{n}{2}}{N}$.\n",
"\n",
"A random graph $\\Gamma_{n,N}$ can be described as a random choice from $E_{n,N}$ such that every element of $E_{n,N}$ has an equal probability of being selected, which is $\\frac{1}{\\binom{\\binom{n}{2}}{N}}$.\n",
"\n",
"Let's take a different approach and use some probability theory. We can consider the formation of a random graph as a stochastic process. This process is defined as follows: at time $t=1$, we pick $N$ edges out of the $\\binom{n}{2}$ potential connections between $V_1, V_2, \\dots, V_n$, all with the same probability of being chosen; we designate this edge as $e_1$. At time $t=2$, we choose one of the $\\binom{n}{2}-1$ remaining possibilities, excluding $e_1$, each with equal probability. This process continues at time $t=k+1$ where we choose one of the remaining $\\binom{n}{2} - k$ possibilities, excluding $e_1, e_2, \\dots, e_k$, each with probability $\\frac{1}{\\binom{n}{2} - k}$. The graph obtained by selecting $N$ edges in this manner is denoted as $\\Gamma_{n,N}$.\n",
"\n",
"\n",
"> NOTE: the two definitions are equivalent, but the second one is more convenient for the study of the properties of random graphs. According to this interpretation we may study the evolution of random graphs, i.e. the step-by-step unraveling of the structure of the graph when $N$ increases. This will be an essential point in our study of the properties of small-worldness."
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## <a id='toc2_2_'></a>[ Erdős-Rényi graphs](#toc0_)\n",
"\n",
"There are two famous groups of graphs that have been extensively analyzed: the set of all graphs with $N$ nodes and $M$ edges, referred to as $G_{N,M}$, and the set of all graphs with $N$ nodes and a connection probability of $p$ between any two nodes, denoted $G_{N,p}$. These sets, first studied by Erdős and Rényi, are alike when $M = \\binom{N}{2} p$ and are therefore referred to as ER graphs if $p$ is not too close to either 0 or 1. `[2]`\n",
"\n",
"A crucial aspect of a graph is its average degree, or the average number of edges attached to each node. The degree of the $i$-th node is represented by $k_i$ and the average degree is denoted by $\\langle k \\rangle$. Graphs with $N$ nodes and $\\langle k \\rangle = O(N^0)$ are called sparse graphs.\n",
"\n",
"One fascinating property of the $G_{N,p}$ set is that several of its features have a corresponding threshold function, $p_t(N)$, such that the property is present with probability 0 if $p < p_t$ and with probability 1 if $p > p_t$ in the \"thermodynamic limit\" of $N \\to \\infty$. This is similar to the physical concept of a percolation phase transition.\n",
"\n",
"> Check out this [impressive paper](https://arxiv.org/abs/2203.17207) that showcases properties of random graphs and their threshold functions. In this concise 6-page article, the Kahn-Kalai Conjecture is proven in a highly elegant manner.\n"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## <a id='toc2_3_'></a>[Scale-free networks](#toc0_)\n",
"\n",
"The Erdős-Rényi model `[4]` has long been the primary focus of research in the field of random graphs. However, recent studies of real-world networks have shown that the ER model does not accurately capture many of their observed properties. One such property that can be easily measured is the degree distribution, or the fraction $P(k)$ of nodes with $k$ connections (degree $k$). A well-known result `[2]` for ER networks is that the degree distribution follows a Poisson distribution, given by \n",
"\n",
"$$ P(k) = \\frac{e^{z} z^k}{k!} $$\n",
"\n",
2 years ago
"where $z = \\langle k \\rangle$ is the average degree `[13]`. However, measurements of the degree distribution for real networks often show that the Poisson law does not hold, instead exhibiting a scale-free degree distribution of the form\n",
"\n",
"$$ P(k) = ck^{-\\gamma} \\quad \\text{for} \\quad k = m, ... , K $$\n",
"\n",
"where $c \\sim (\\gamma -1)m^{\\gamma - 1}$ is a normalization factor, and $m$ and $K$ are the lower and upper cutoffs for the degree of a node, respectively. The divergence of moments higher than $\\lceil \\gamma -1 \\rceil$ (as $K \\to \\infty$ when $N \\to \\infty$) is responsible for many of the unusual properties attributed to scale-free networks.\n",
"\n",
2 years ago
"It is important to note that all real-world networks are finite, so all of their moments are finite as well. The actual value of the cutoff $K$ plays a significant role, and can be approximated by noting that the total probability of nodes with $k > K$ is approximately $1/N$ `[14]`, or\n",
"\n",
"$$ \\int_K^\\infty P(k) dk \\sim \\frac{1}{N} $$\n",
"\n",
"This gives the result\n",
"\n",
"$$ K \\sim m N^{1/(\\gamma -1)} $$\n",
"\n",
"The degree distribution is not the only characteristic that can be used to describe a network. Other quantities, such as the degree-degree correlation (between connected nodes), spatial correlations, clustering coefficient, betweenness or centrality distribution, and self-similarity exponents, can also provide insight into the network's structure and behavior."
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"### <a id='toc2_3_1_'></a>[Diameter and fractal dimension (infinite-dimensional networks)](#toc0_)\n",
"\n",
"> This section in only a brief introduction to the topic and a bit unrelated to the rest of the project. I decided to include it anyway since it gives a more complete picture when we will introduce the Watts-Strogatz model. However, it can be skipped without any loss of information.\n",
"\n",
2 years ago
"Regular lattices can be viewed as networks embedded in Euclidean space of a defined dimension $d$, meaning that $n(r)$, the number of nodes within a distance $r$ from an origin, grows as $n(r) \\sim r^d$ for large $r$. For fractal objects, the dimension $d$ in this relation may be a non-integer and is replaced by the fractal dimension $d_f$. `[2]`\n",
"\n",
"One example of a network where these power laws do not hold is the Cayley tree, also known as the Bethe lattice, which is a regular graph of fixed degree $z$ with no loops. An infinite Cayley tree cannot be embedded in a Euclidean space of finite dimensionality. The number of nodes at level $l$ grows as $n(l) \\sim (z - 1)^l$, which is faster than any power law, making Cayley trees infinite-dimensional systems.\n",
"\n",
2 years ago
"![Photo from [2]](https://i.imgur.com/VLxR3AL.png)\n",
"\n",
2 years ago
"_Taken from [2]_\n",
"\n",
2 years ago
"Many random network models have locally tree-like structure (since most loops occur only when $n(l) \\sim N$), and since the number of nodes grows as $n(l) \\sim \\langle k - 1 \\rangle^l$, they are also infinite dimensional. As a result, the diameter of such graphs (i.e., the shortest path between the most distant nodes) scales as $D \\sim \\ln N$ `[13]`. Many properties of ER networks, including the logarithmic diameter, are also present in Cayley trees. This small diameter is in contrast to that of finite-dimensional lattices, where $D \\sim N^{1/d_l}$.\n",
"\n",
"Like ER networks, percolation on infinite-dimensional lattices and the Cayley tree exhibits a critical threshold $p_c = 1/(z - 1)$. For $p > p_c$, a \"giant cluster\" of size $N$ exists, while for $p < p_c$, only small clusters are present. At criticality ($p = p_c$) in infinite-dimensional lattices (similar to ER networks), the giant component is of size $N^{2/3}$. This result follows from the fact that percolation on lattices in dimension $d \\geq d_c = 6$ is in the same universality class as infinite-dimensional percolation, where the fractal dimension of the giant cluster is $d_f = 4$, resulting in a size of the giant cluster that scales as $N^{d_f/d_c} = N^{2/3}$. The dimension $d_c$ is known as the \"upper critical dimension,\" and this concept exists not only in percolation phenomena, but also in other physical models such as the self-avoiding walk model for polymers and the Ising model for magnetism, in both of which $d_c = 4$. `[2]`"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## <a id='toc2_4_'></a>[Watts-Strogatz model](#toc0_)\n",
"\n",
2 years ago
"In the year 1998, Watts and Strogatz presented a novel model for small-world networks in their seminal work `[3]`. This model preserves the high degree of local clustering, which is a characteristic of lattice structures where the neighbors of a node are more likely to be neighbors with each other than in random graphs. The model achieves a reduction in the diameter of the network to $D \\sim \\ln N$ by randomly rewiring a fraction $\\varphi$ of the links in a regular lattice to connect to distant nodes. The rewiring procedure is based on a probability $p$ assigned to each edge. If an edge is selected for rewiring, it is substituted with a new edge chosen at random with uniform probability. The resulting network is characterized by $N$ nodes, $k$ nearest neighbors, and an average distance of $\\log(N)/\\log(k)$.\n",
"\n",
"More details on the Watts-Strogatz model can be found in `[3]`."
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## <a id='toc2_5_'></a>[Random graphs as a model of real networks](#toc0_)\n",
"\n",
2 years ago
"Many physical and man-made systems can be represented as networks, which consist of objects and the interactions between them. Some examples include computer networks, such as the Internet, and logical networks, including the links between web pages and email networks, where the presence of an individual's address in another person's address book is represented by a link. Additionally, social interactions in populations or work relationships and movements of a system in a configuration space can also be described using a network. These examples, along with many others, possess a graph structure that can be studied. Although many of these networks exhibit some ordered structure, such as cluster and group formation, geographical or geometrical considerations, or specific properties, most of them possess complex and random structures that deviate from regular lattices. As a result, it is often assumed, with caution, that they share properties with random graph models.\n",
"\n",
"Scale-free networks can be considered as a generalization of Erdős-Rényi (ER) networks. When $\\gamma > 4$, the properties of scale-free networks, such as distances, optimal paths, and percolation, are similar to those in ER networks. Conversely, when $\\gamma < 4$, these properties exhibit anomalous behavior due to the strong heterogeneity in the degrees of nodes, which disrupts the node-to-node translational homogeneity (symmetry) present in classical homogeneous networks such as lattices, Cayley trees, and ER graphs. `[2]`\n",
"\n",
"---"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"In this section of the notebook, we'll delve into the technical aspect of analyzing the properties of real-world networks that were discussed previously. We will try to make as much usage as possibile of the [networkx](https://networkx.org/) library. However, some algorithms required manual implementation and can be found in the `utils.py` module that I strongly recommend to read.\n",
"\n",
2 years ago
"The computations were executed on an Arch Linux machine with a AMD Ryzen 5 2600 processor (6 cores and 12 threads) and 16 GB of RAM. The code was written in Python 3.10.9, and the required packages can be installed by executing the following command in the terminal:\n",
"\n",
"```bash\n",
"pip3 install -r requirements.txt\n",
"```\n",
"\n",
"I have made efforts to ensure that the code is widely compatible, but I was unable to test it on a Windows or MacOS machine since I have neither of those operating systems installed on any of my personal devices. In the event that any issues are encountered, please inform me so I can work towards resolving them."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# <a id='toc3_'></a>[Discovering the datasets](#toc0_)\n",
2 years ago
"\n",
"To perform our analysis, we will use the following datasets:\n",
"\n",
"- **Brightkite**\n",
"- **Gowalla**\n",
"- **Foursquare**\n",
"\n",
"We can download the datasets using the function `download_dataset` from the `utils` module. It will download the datasets in the `data` folder, organized in sub-folders in the following way:\n",
"\n",
"```\n",
"data\n",
"├── brightkite\n",
"│ ├── brightkite_checkins_full.txt\n",
"│ └── brightkite_friends_edges.txt\n",
"├── foursquare\n",
"│ ├── foursquare_checkins_full.txt\n",
"│ ├── foursquare_friends_edges.txt\n",
"│ └── raw_POIs.txt\n",
"└── gowalla\n",
" ├── gowalla_checkins_full.txt\n",
" └── gowalla_friends_edges.txt\n",
"```\n",
"\n",
"For further details about the function below, please refer to the `utils` module.\n",
"\n",
"> **NOTE:** the Stanford servers tends to be slow, so it may take a few minutes to download them."
]
},
{
"cell_type": "code",
2 years ago
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Created data folder\n",
"Created brightkite folder\n",
"Created gowalla folder\n",
"Created foursquare folder\n",
"Downloading https://snap.stanford.edu/data/loc-brightkite_edges.txt.gz...\n",
"Downloading https://snap.stanford.edu/data/loc-brightkite_totalCheckins.txt.gz...\n",
"Downloading https://snap.stanford.edu/data/loc-gowalla_edges.txt.gz...\n",
"Downloading https://snap.stanford.edu/data/loc-gowalla_totalCheckins.txt.gz...\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Downloading...\n",
"From: https://drive.google.com/uc?id=1PNk3zY8NjLcDiAbzjABzY5FiPAFHq6T8\n",
"To: /home/luke/github/small-worlds/data/foursquare/foursquare_full.zip\n",
2 years ago
"100%|██████████| 2.68G/2.68G [02:03<00:00, 21.8MB/s]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Unzipping loc-brightkite_edges.txt.gz...\n",
"Unzipping loc-brightkite_totalCheckins.txt.gz...\n",
"Unzipping loc-gowalla_edges.txt.gz...\n",
"Unzipping loc-gowalla_totalCheckins.txt.gz...\n",
"Unzipping foursquare_full.zip...\n",
2 years ago
"Archive: /home/luke/github/small-worlds/data/foursquare/foursquare_full.zip\n",
" creating: /home/luke/github/small-worlds/data/foursquare/dataset_WWW2019/\n",
" inflating: /home/luke/github/small-worlds/data/foursquare/dataset_WWW2019/raw_Checkins_anonymized.txt \n",
" inflating: /home/luke/github/small-worlds/data/foursquare/dataset_WWW2019/.DS_Store \n",
" creating: /home/luke/github/small-worlds/data/foursquare/__MACOSX/\n",
" creating: /home/luke/github/small-worlds/data/foursquare/__MACOSX/dataset_WWW2019/\n",
" inflating: /home/luke/github/small-worlds/data/foursquare/__MACOSX/dataset_WWW2019/._.DS_Store \n",
" inflating: /home/luke/github/small-worlds/data/foursquare/dataset_WWW2019/raw_POIs.txt \n",
" inflating: /home/luke/github/small-worlds/data/foursquare/dataset_WWW2019/dataset_WWW_friendship_old.txt \n",
" inflating: /home/luke/github/small-worlds/data/foursquare/dataset_WWW2019/dataset_WWW_readme.txt \n",
" inflating: /home/luke/github/small-worlds/data/foursquare/__MACOSX/dataset_WWW2019/._dataset_WWW_readme.txt \n",
" inflating: /home/luke/github/small-worlds/data/foursquare/dataset_WWW2019/dataset_WWW_Checkins_anonymized.txt \n",
" inflating: /home/luke/github/small-worlds/data/foursquare/dataset_WWW2019/dataset_WWW_friendship_new.txt \n"
]
}
],
"source": [
"# this is a long and boring function to automatically download, extract, rename and save the datasets in a clean way. If you want to have a deeper look at the code, you can find it in utils.py\n",
"\n",
"download_datasets() # it takes about 3-4 minutes to download and extract the datasets with a fiber connection\n",
"\n",
"## If you want to run it again, delete the data folder and run the function again"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### <a id='toc3_1_1_'></a>[Brightkite](#toc0_)\n",
"\n",
"[Brightkite](http://www.brightkite.com/) was a location-based social networking service that allowed users to share their locations by checking in. The friendship network data was collected using the Brightkite public API. There are two datasets available for analysis: \n",
"\n",
"- `brightkite_checkins_full.txt`, which contains check-in data in the form of a tab-separated file with five columns: `user id`, `check-in time`, `latitude`, `longitude`, and `location id`\n",
" \n",
"- `brightkite_friends_edges.txt`, which is a tab-separated file with two columns containing user IDs and representing the friendship network in the form of a graph edge list. \n",
"\n",
"The `brightkite_checkins_full.txt` dataset must be converted into a graph before it can be analyzed properly, while the `brightkite_friends_edges.txt` dataset is already in a usable form for graph analysis.\n",
"\n",
"Let's have a more clear view of where our data have been generated"
]
},
{
"cell_type": "code",
2 years ago
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Number of unique users: 35538\n"
]
},
{
"data": {
"text/plain": [
"<AxesSubplot: >"
]
},
2 years ago
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "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
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# It takes about 2 minutes to run this block\n",
"\n",
"df_brighkite = pd.read_csv(os.path.join('data', 'brightkite', 'brightkite_checkins_full.txt'), \n",
" sep='\\t', \n",
" header=None,\n",
" names=['user id', 'check-in time', 'latitude', 'longitude', 'location id'],\n",
" parse_dates=['check-in time'],\n",
" engine='pyarrow') # multi-threaded engine (sometimes it's faster)\n",
"\n",
"# take only data from 2009\n",
"df_brighkite = df_brighkite[df_brighkite['check-in time'].dt.year == 2009]\n",
"\n",
"# convert the dataframe to geopandas dataframe\n",
"gdf_brightkite = gpd.GeoDataFrame(df_brighkite, geometry=gpd.points_from_xy(df_brighkite.longitude, df_brighkite.latitude))\n",
"\n",
"# plot the geopandas dataframe\n",
"print(\"Number of unique users: \", len(df_brighkite['user id'].unique()))\n",
"gdf_brightkite.plot(marker='o', color='blue', markersize=1)"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"Familiar shape, isn't it? As we can see there are ~35k nodes, a bit too much for our future computation. Let's take a subset, like Europe!"
]
},
{
"cell_type": "code",
2 years ago
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Number of unique users in Europe: 8525\n"
]
},
{
"data": {
"image/png": "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
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"gdf_brightkite = gdf_brightkite[gdf_brightkite['latitude'] < 60]\n",
"gdf_brightkite = gdf_brightkite[gdf_brightkite['latitude'] > 35]\n",
"gdf_brightkite = gdf_brightkite[gdf_brightkite['longitude'] < 30]\n",
"gdf_brightkite = gdf_brightkite[gdf_brightkite['longitude'] > -10]\n",
"\n",
"gdf_brightkite.plot(marker='o', color='blue', markersize=1)\n",
"\n",
"# update the pandas dataframe with the new values\n",
"df_brighkite = gdf_brightkite\n",
"print(\"Number of unique users in Europe: \", len(df_brighkite['user id'].unique()))\n",
"\n",
"# remove from memory the geopandas dataframe, it was only used for plotting\n",
"del gdf_brightkite"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Perfect! Now we can create a new .txt file, only with the information that we need"
]
},
{
"cell_type": "code",
2 years ago
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"# update the file with the new values. Drop the columns that are not needed\n",
"df_brighkite.to_csv(\n",
" os.path.join('data', 'brightkite', 'brightkite_checkins.txt'), \n",
" sep='\\t', \n",
" header=False, \n",
" index=False, \n",
" columns=['user id', 'location id'])\n",
"\n",
"# I prefer not to delete the full dataset, since it's bad practice in my opinion. If you want to delete it, uncomment the following line\n",
"\n",
"# os.remove(os.path.join('data', 'brightkite', 'brightkite_checkins_full.txt'))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### <a id='toc3_1_2_'></a>[Gowalla](#toc0_)\n",
"\n",
"Gowalla is a location-based social networking website where users share their locations by checking-in. The friendship network is undirected and was collected using their public API. As for Brightkite, we will work with two different datasets. This is how they look like after being filtered by the `download_dataset` function:\n",
"\n",
"- `data/gowalla/gowalla_checkins.txt`: the checkins, a tsv file with 5 columns: `user id`, `check-in time`, `latitude`, `longitude`, `location id`\n",
"\n",
"- `data/gowalla/gowalla_friends_edges.txt`: the friendship network, a tsv file with 2 columns of users ids. This file it's in the form of a graph edge list. \n",
"\n",
"\n",
"Let's have a more clear view of where our data have been generated"
]
},
{
"cell_type": "code",
2 years ago
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Number of unique users: 12611\n"
]
},
{
"data": {
"image/png": "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
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"df_gowalla = pd.read_csv(os.path.join('data', 'gowalla', 'gowalla_checkins_full.txt'),\n",
" sep='\\t', \n",
" header=None,\n",
" names=['user id', 'check-in time', 'latitude', 'longitude', 'location id'],\n",
" parse_dates=['check-in time'],\n",
" engine='pyarrow')\n",
"\n",
"# take only data from 2009\n",
"df_gowalla = df_gowalla[df_gowalla['check-in time'].dt.year == 2009]\n",
"\n",
"# convert the dataframe to geopandas dataframe\n",
"gdf_gowalla = gpd.GeoDataFrame(df_gowalla, geometry=gpd.points_from_xy(df_gowalla.longitude, df_gowalla.latitude))\n",
"\n",
"# plot the geopandas dataframe\n",
"gdf_gowalla.plot(marker='o', color='red', markersize=1)\n",
"print(\"Number of unique users: \", len(df_gowalla['user id'].unique()))"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"This is still a bit too much, let's take a subset of the European area"
]
},
{
"cell_type": "code",
2 years ago
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Number of unique users in the EU area: 3718\n"
]
},
{
"data": {
"image/png": "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
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"gdf_gowalla = gdf_gowalla[gdf_gowalla['latitude'] < 60]\n",
"gdf_gowalla = gdf_gowalla[gdf_gowalla['latitude'] > 35]\n",
"gdf_gowalla = gdf_gowalla[gdf_gowalla['longitude'] < 30]\n",
"gdf_gowalla = gdf_gowalla[gdf_gowalla['longitude'] > -10]\n",
"\n",
"gdf_gowalla.plot(marker='o', color='red', markersize=1)\n",
"\n",
"df_gowalla = gdf_gowalla\n",
"print(\"Number of unique users in the EU area: \", len(df_gowalla['user id'].unique()))\n",
"\n",
"# remove from memory the geopandas dataframe, it was only used for plotting\n",
"del gdf_gowalla"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Perfect! Now we can create a new .txt file, only with the information that we need"
]
},
{
"cell_type": "code",
2 years ago
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"# update the file with the new values. Drop the columns that are not needed\n",
"df_gowalla.to_csv(\n",
" os.path.join('data', 'gowalla', 'gowalla_checkins.txt'), \n",
" sep='\\t', \n",
" header=False, \n",
" index=False, \n",
" columns=['user id', 'location id'])\n",
"\n",
"# os.remove(os.path.join('test_data', 'brightkite', 'brightkite_checkins_full.txt'))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### <a id='toc3_1_3_'></a>[Foursquare](#toc0_)\n",
"\n",
"[Foursquare](https://foursquare.com/) is a location-based social networking website where users share their locations by checking-in. This dataset includes long-term (about 22 months from Apr. 2012 to Jan. 2014) global-scale check-in data collected from Foursquare, and also two snapshots of user social networks before and after the check-in data collection period (see more details in the reference paper `[15]`). We will work with three different datasets:\n",
"\n",
"- `foursquare_checkins_full.txt`: a tsv file with 4 columns: `User ID`, `Venue ID`, `UTC time`, `Timezone offset in minutes` \n",
"\n",
"- `foursquare_friends_edges.txt`: the friendship network, a tsv file with 2 columns of users ids. This is in the form of a graph edge list. \n",
"\n",
"- `raw_POIs.txt`: the POIS, a tsv file with 5 columns: `Venue ID`, `Latitude`, `Longitude`, `Venue category name`, `Country code (ISO)`.\n",
"\n",
"--- \n",
"\n",
"The check-in dataset in consideration is by fare the bigger of this study, it has `22809624` check-ins made by `114324` users at `3820891` venues. Additionally, the social network data consists of `607333` friendships. As previously indicated, the need for sub-sampling becomes a must due to the size of the full network. In this instance, we shall restrict our analysis to data generated in Italy in the year 2012. Given the substantial size of the full network, plotting it would likely result in an unfavorable outcome, as the available RAM may become exhausted and the kernel may be forced to terminate the process."
]
},
{
"cell_type": "code",
2 years ago
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Number of unique users in Italy: 2555\n"
]
},
{
"data": {
"image/png": "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
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"df_foursquare_POIS = pd.read_csv(os.path.join('data', 'foursquare', 'raw_POIs.txt'), \n",
" sep='\\t',\n",
" header=None,\n",
" names=['venue id', 'latitude', 'longitude', 'venue category name', 'ISO code'],\n",
" dtype={'venue id': str, 'latitude': float, 'longitude': float, 'venue category name': str, 'ISO code': str},\n",
" engine='c')\n",
"\n",
"df_foursquare_checkins = pd.read_csv(os.path.join('data', 'foursquare', 'foursquare_checkins_full.txt'),\n",
" sep='\\t',\n",
" header=None,\n",
" names=['user id', 'venue id', 'UTC time', 'offset'],\n",
" dtype={'user id': str, 'venue id': str, 'UTC time': str, 'offset': int},\n",
" engine='c')\n",
"\n",
"# Take only data with IT ISO code\n",
"df_foursquare_POIS = df_foursquare_POIS[df_foursquare_POIS['ISO code'] == 'IT']\n",
"\n",
"# Take only the checkins that are in the POIs (filtered by ISO code) and viceversa\n",
"df_foursquare_checkins = df_foursquare_checkins[df_foursquare_checkins['venue id'].isin(df_foursquare_POIS['venue id'])]\n",
"df_foursquare_POIS = df_foursquare_POIS[df_foursquare_POIS['venue id'].isin(df_foursquare_checkins['venue id'])]\n",
"\n",
"# Convert to datetime\n",
"df_foursquare_checkins['UTC time'] = pd.to_datetime(df_foursquare_checkins['UTC time'])\n",
"\n",
"# Take only the data from 2012\n",
"df_foursquare_checkins = df_foursquare_checkins[df_foursquare_checkins['UTC time'].dt.year == 2012]\n",
"\n",
"# convert the dataframe to geopandas dataframe\n",
"gdf_foursquare_POIS = gpd.GeoDataFrame(df_foursquare_POIS, geometry=gpd.points_from_xy(df_foursquare_POIS.longitude, df_foursquare_POIS.latitude))\n",
"\n",
"# plot the geopandas dataframe\n",
"gdf_foursquare_POIS.plot(marker='o', color='red', markersize=1)\n",
"print('Number of unique users in Italy: ', len(df_foursquare_checkins['user id'].unique()))\n",
"\n",
"# delete from memory the geo dataframe, it was only used for plotting\n",
"del gdf_foursquare_POIS"
]
},
{
"cell_type": "code",
2 years ago
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
"df_foursquare_checkins.to_csv(\n",
" os.path.join('data', 'foursquare', 'foursquare_checkins.txt'),\n",
" sep='\\t',\n",
" header=False,\n",
" index=False,\n",
" columns=['user id', 'venue id'])\n",
"\n",
"# os.remove(os.path.join('test_data', 'foursquare', 'foursquare_checkins_full.txt'))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## <a id='toc3_2_'></a>[Building the networks](#toc0_)"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"### <a id='toc3_2_1_'></a>[Check-ins networks](#toc0_)\n",
"\n",
2 years ago
"The construction of networks for the three datasets will be accomplished by representing them as an undirected graph $M = (V, E)$, with $V$ denoting the set of nodes and $E$ denoting the set of edges. The nodes will correspond to the users and the edges will indicate the presence of at least one instance where two individuals visited the same location.\n",
"\n",
"Since the check-ins files of the three datasets are not in the format of a graph edge list, it is necessary to manipulate them."
]
},
{
"cell_type": "code",
2 years ago
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"gowalla\n",
"Number of lines: 83269\n",
"Number of unique elements: 3718\n",
"\n",
"brightkite\n",
"Number of lines: 391220\n",
"Number of unique elements: 8525\n",
"\n",
"foursquare\n",
"Number of lines: 125076\n",
"Number of unique elements: 2555\n",
"\n"
]
}
],
"source": [
"def count_lines_and_unique_elements(file):\n",
" df = pd.read_csv(file, sep='\\t', header=None)\n",
" print('Number of lines: ', len(df))\n",
" print('Number of unique elements: ', len(df[0].unique()))\n",
"\n",
"gowalla_path = os.path.join('data', 'gowalla', 'gowalla_checkins.txt')\n",
"brightkite_path = os.path.join('data', 'brightkite', 'brightkite_checkins.txt')\n",
"foursquare_path = os.path.join('data', 'foursquare', 'foursquare_checkins.txt')\n",
"\n",
"_ = [gowalla_path, brightkite_path, foursquare_path]\n",
"\n",
"for path in _:\n",
" print(path.split(os.sep)[-2])\n",
" count_lines_and_unique_elements(path)\n",
" print()"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"We want to construct a graph from an edge list. To accomplish this, we will examine the users that have visited each venue. Subsequently, we will establish an edge between every pair of users who have visited the same venue, while avoiding duplications. This process can be executed efficiently (algorithmically speaking) in Python, although it may entail a slow computational time due the nature of the language itself. The methodology for creating this graph is illustrated below in the Python code snippet.\n",
"\n",
"```python\n",
"# let df be the dataframe [\"user_id\", \"venue_id\"] of the checkins\n",
"\n",
"venues_users = df.groupby(\"venue_id\")[\"user_id\"].apply(set)\n",
"\n",
" for users in venues_users:\n",
" for user1, user2 in combinations(users, 2):\n",
" G.add_edge(user1, user2)\n",
"```\n",
"\n",
2 years ago
"The code makes use of a dataframe, `df`, which contains the `user_id` and `venue_id` information for each check-in. The code first groups the check-ins by the `venue_id` and applies a set function to the `user_id` values. Then, the code iterates through each set of users that visited the same venue and adds an edge between every pair of users.\n",
"\n",
"I have included a function in the `utils.py` module that performs this process automatically. The function, named `create_graph_from_checkins`, takes as input the name of the data set and returns a graph object in the NetworkX library. By default, this function also writes the edge list to a file in the respective dataset folder. The available options for the input dataset are \"brightkite\", \"gowalla\", and \"foursquare\". An example of how to use this function is shown below."
]
},
{
"cell_type": "code",
2 years ago
"execution_count": 12,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Creating the graph for the dataset brightkite...\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 84831/84831 [00:00<00:00, 310564.31it/s]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Done! The graph has 292973 edges and 6493 nodes\n",
"\n",
"Creating the graph for the dataset gowalla...\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 31095/31095 [00:00<00:00, 331735.68it/s]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Done! The graph has 62790 edges and 3073 nodes\n",
"\n",
"Creating the graph for the dataset foursquare...\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 40650/40650 [00:00<00:00, 147409.04it/s]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Done! The graph has 246702 edges and 2324 nodes\n"
]
}
],
"source": [
"G_brighkite_checkins = create_graph_from_checkins('brightkite', create_file=True)\n",
"G_brighkite_checkins.name = 'Brightkite Checkins Graph'\n",
"\n",
"G_gowalla_checkins = create_graph_from_checkins('gowalla', create_file=True)\n",
"G_gowalla_checkins.name = 'Gowalla Checkins Graph'\n",
"\n",
"G_foursquare_checkins = create_graph_from_checkins('foursquare', create_file=True)\n",
"G_foursquare_checkins.name = 'Foursquare Checkins Graph'"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### <a id='toc3_2_2_'></a>[Friendship network](#toc0_)\n",
"\n",
"\n",
2 years ago
"We want to construct a friendship graph that represents the relationships between users in a social network. The concept of friendship will be modeled in accordance with the paradigm of Facebook, as opposed to Twitter. Consequently, the graph will be undirected and edges will not be weighted. Moreover, it is imperative to note that a user cannot be friends with himself, nor can he be friends with another user if the latter is not friends with him.\n",
"\n",
2 years ago
"The friendship graph will be generated using the function `create_friendships_graph` located in the `utils.py` module. The function takes as input the name of the dataset and returns a networkx graph object. By default, the edge list will also be written to a file within the respective dataset folder. The available options for the input dataset are _brightkite_, _gowalla_, and _foursquare_.\n",
"\n",
"> It is worth mentioning that this function has been implemented in a manner that does not require the checkins graph to be loaded in memory. Instead, it utilizes the edge list file. This was done with the consideration that some users may only perform analysis on the friendship network, and as such, there is no need to load the checkins graph and waste memory. "
]
},
{
"cell_type": "code",
2 years ago
"execution_count": 13,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Created the graph for the dataset brightkite with 14690 edges and 5420 nodes\n",
"Created the graph for the dataset gowalla with 5548 edges and 2294 nodes\n",
"Created the graph for the dataset foursquare with 5323 edges and 1397 nodes\n"
]
}
],
"source": [
"G_brighkite_friends = create_friendships_graph('brightkite', create_file=True)\n",
"G_brighkite_friends.name = 'Brightkite Friendship Graph'\n",
"\n",
"G_gowalla_friends = create_friendships_graph('gowalla', create_file=True)\n",
"G_gowalla_friends.name = 'Gowalla Friendship Graph'\n",
"\n",
"G_foursquare_friends = create_friendships_graph('foursquare', create_file=True)\n",
"G_foursquare_friends.name = 'Foursquare Friendship Graph'"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
2 years ago
"The networks under investigation are more abstract than previously observed networks as they lack geographical information. To gain insight into their structure, we can use a Newtonian gravity model to examine the interactions between the nodes. Given that the plot will be presented on a web page in the form of an html file, it is necessary to sample the network extensively. Although this process will not provide an exact representation of the network, it will provide a general understanding of the distribution of nodes. To achieve this, we will use a subsample of approximately 1000 nodes from the largest connected component. \n",
"\n",
2 years ago
"This task can be performed through the `visualize_graphs` function in the `utils.py` module. The function requires as inputs a networkx graph object, a `k` percentage of nodes to remove, and a `connected` boolean that specifies whether to only consider the largest connected component. By default, `k` is set to obtain a subsample of around 1000 nodes, and connected is set to `True`. The function outputs an html file that can be opened in a web browser. All files will be downloaded to the `html_graphs` folder."
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The graph has been saved in the folder html_graphs with the name brightkite_friendship_graph.html\n",
"The graph has been saved in the folder html_graphs with the name gowalla_friendship_graph.html\n",
"The graph has been saved in the folder html_graphs with the name foursquare_friendship_graph.html\n"
]
}
],
"source": [
"friendships_graph = [G_brighkite_friends, G_gowalla_friends, G_foursquare_friends]\n",
"\n",
"for graph in friendships_graph:\n",
" visualize_graphs(graph, k = None, connected=True)\n",
"\n",
"# if we are curios about the checkins graphs, nothing prevents us to visualize them. Just uncomment the following lines. However, this has not been tested properly, so we might encounter some slow-downs with the checkins graphs\n",
"\n",
"# checkins_graph = [G_brighkite_checkins, G_gowalla_checkins, G_foursquare_checkins]\n",
"# for graph in checkins_graph:\n",
"# visualize_graphs(graph, k = 0.7, connected=True)"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"On a unix environment, if firefox is installed, we can visualize them by running the following command:\n",
"\n",
"```bash\n",
"firefox html_graphs/*.html\n",
"```\n",
"\n",
"Otherwise, I have already made this computations and the results can be visualized following the links below\n",
"\n",
"- [Brightkite](https://lukefleed.xyz/graphs/brightkite_friendship_graph.html)\n",
"- [Gowalla](https://lukefleed.xyz/graphs/gowalla_friendship_graph.html)\n",
"- [Foursquare](https://lukefleed.xyz/graphs/foursquare_friendship_graph.html)\n",
"\n",
"> **EXTRA:** If you want to see a visualization of a complete different graph, here you can check che collaboration network of the actors on the IMDb website. It has very distinct communities and clusters. Only actors with more then 100 movies have been considered. Click [here](https://lukefleed.xyz/graph/imdb-graph.html) to see the visualization."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# <a id='toc4_'></a>[Properties of the networks](#toc0_)\n",
"\n",
"In order to effectively visualize the outcomes of our analysis, we will construct a dataframe that encapsulates all the information retrieved from the networks under examination. It should be noted that the full networks, despite having undergone filtering, are still substantial in size, which results in prolonged execution times for the functions that we are going to use. To mitigate this issue, we will take sub-samples. Keep in mind that the accuracy of the results is proportional to the size of the sample utilized.\n",
"\n",
"In light of these considerations, I recommend conducting an initial review of the notebook with higher values of the sampling rate (the default ones) to expedite the display of the results and gain an understanding of the functionality of the implemented functions. At the end of this section I provided a link to my GitHub repository, where the results obtained through lower sampling rates can be downloaded. This approach allows for a preliminary assessment of the functionality of the functions with mock-networks, before proceeding with the analysis using the more precise results that necessitate longer computation times."
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [],
"source": [
"checkins_graphs = [G_brighkite_checkins, G_gowalla_checkins, G_foursquare_checkins]\n",
"friendships_graph = [G_brighkite_friends, G_gowalla_friends, G_foursquare_friends]\n",
"\n",
"graphs_all = checkins_graphs + friendships_graph"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Graph</th>\n",
" <th>Number of Nodes</th>\n",
" <th>Number of Edges</th>\n",
" <th>Average Degree</th>\n",
" <th>Average Clustering Coefficient</th>\n",
" <th>log N</th>\n",
" <th>Average Shortest Path Length</th>\n",
" <th>betweenness centrality</th>\n",
" <th>omega-coefficient</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Brightkite Checkins Graph</td>\n",
" <td>6493</td>\n",
" <td>292973</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>8.778480</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Gowalla Checkins Graph</td>\n",
" <td>3073</td>\n",
" <td>62790</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>8.030410</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Foursquare Checkins Graph</td>\n",
" <td>2324</td>\n",
" <td>246702</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>7.751045</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Brightkite Friendship Graph</td>\n",
" <td>1500</td>\n",
" <td>1072</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>7.313220</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Gowalla Friendship Graph</td>\n",
" <td>1500</td>\n",
" <td>2309</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>7.313220</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>Foursquare Friendship Graph</td>\n",
" <td>1397</td>\n",
" <td>5323</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>7.242082</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Graph Number of Nodes Number of Edges Average Degree \\\n",
"0 Brightkite Checkins Graph 6493 292973 NaN \n",
"1 Gowalla Checkins Graph 3073 62790 NaN \n",
"2 Foursquare Checkins Graph 2324 246702 NaN \n",
"3 Brightkite Friendship Graph 1500 1072 NaN \n",
"4 Gowalla Friendship Graph 1500 2309 NaN \n",
"5 Foursquare Friendship Graph 1397 5323 NaN \n",
"\n",
" Average Clustering Coefficient log N Average Shortest Path Length \\\n",
"0 NaN 8.778480 NaN \n",
"1 NaN 8.030410 NaN \n",
"2 NaN 7.751045 NaN \n",
"3 NaN 7.313220 NaN \n",
"4 NaN 7.313220 NaN \n",
"5 NaN 7.242082 NaN \n",
"\n",
" betweenness centrality omega-coefficient \n",
"0 NaN NaN \n",
"1 NaN NaN \n",
"2 NaN NaN \n",
"3 NaN NaN \n",
"4 NaN NaN \n",
"5 NaN NaN "
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"analysis_results = pd.DataFrame(columns=['Graph', 'Number of Nodes', 'Number of Edges', 'Average Degree', 'Average Clustering Coefficient', 'log N', 'Average Shortest Path Length', 'betweenness centrality', 'omega-coefficient'], index=None)\n",
"\n",
"for graph in graphs_all:\n",
" analysis_results = analysis_results.append(\n",
" {'Graph': graph.name, \n",
" 'Number of Nodes': graph.number_of_nodes(), \n",
" 'log N': np.log(graph.number_of_nodes()),\n",
" 'Number of Edges': graph.number_of_edges()}, \n",
" ignore_index=True)\n",
"\n",
"analysis_results"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## <a id='toc4_1_'></a>[Average Degree](#toc0_)\n",
"\n",
2 years ago
"The concept of degree refers to the number of links that are connected to a particular node. While the average degree is a basic measure, it is not deemed to be of significant utility for our upcoming analysis, thus it will not be given extensive consideration. In contrast, the degree distribution, represented by $P(k)$, which represents the proportion of nodes that have a degree of $k$, is deemed to be a more meaningful metric. The literature on network analysis indicates that real-world networks often do not adhere to the Poisson degree distribution that is predicted by the ER model. Instead, many networks exhibit a degree distribution with a long-tailed, power-law distribution, such that $P(k) \\sim k^{-\\gamma}$, with a value of $\\gamma$ typically ranging from $2$ to $3$."
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Graph</th>\n",
" <th>Average Degree</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Brightkite Checkins Graph</td>\n",
" <td>90.242723</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Gowalla Checkins Graph</td>\n",
" <td>40.865604</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Foursquare Checkins Graph</td>\n",
" <td>212.30809</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Brightkite Friendship Graph</td>\n",
" <td>1.429333</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Gowalla Friendship Graph</td>\n",
" <td>3.078667</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>Foursquare Friendship Graph</td>\n",
" <td>7.620616</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Graph Average Degree\n",
"0 Brightkite Checkins Graph 90.242723\n",
"1 Gowalla Checkins Graph 40.865604\n",
"2 Foursquare Checkins Graph 212.30809\n",
"3 Brightkite Friendship Graph 1.429333\n",
"4 Gowalla Friendship Graph 3.078667\n",
"5 Foursquare Friendship Graph 7.620616"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"for G in graphs_all:\n",
" avg_deg = np.mean([d for n, d in G.degree()])\n",
" analysis_results.loc[analysis_results['Graph'] == G.name, 'Average Degree'] = avg_deg\n",
"\n",
"analysis_results[['Graph', 'Average Degree']]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## <a id='toc4_2_'></a>[Clustering coefficient](#toc0_)\n",
"\n",
2 years ago
"The Clustering Coefficient `[2]` refers to the concept of communities represented by local structures in a network. This notion is generally related to the number of triangles present in the network and considered high when two nodes sharing a common neighbor exhibit a high probability of being connected. There are two commonly accepted definitions of clustering: the global definition and the local definition.\n",
"\n",
"The global definition of clustering is expressed mathematically as follows:\n",
"\n",
"$$ C = \\frac{3 \\times \\text{the number of triangles in the network}}{\\text{the number of connected triples of vertices}}$$\n",
"\n",
2 years ago
"where a “connected triple” represents a vertex with edges connecting to an unordered pair of other vertices.\n",
"\n",
2 years ago
"The local definition of clustering, on the other hand, is based on the average of the clustering coefficient of individual nodes. The clustering coefficient for a single node is defined as the fraction of pairs of its linked neighbors to the total number of pairs of its neighbors. This relationship can be mathematically represented as:\n",
"\n",
2 years ago
"$$ C_i = \\frac{\\text{the number of triangles connected to vertex }i}{\\text{the number of triples centered on vertex } i} $$\n",
"\n",
2 years ago
"For vertices with degree $0$ or $1$, the numerator and denominator of the equation are both equal to zero, and in such cases, $C_i = 0$. The clustering coefficient for the whole network is then obtained as the average of $C_i$ as expressed in the equation below:\n",
"\n",
2 years ago
"$$ C = \\frac{1}{n} \\sum_{i} C_i $$\n",
"\n",
2 years ago
"It is important to note that the clustering coefficient is always in the range of $0 \\leq C \\leq 1$. In random graph models such as the ER model and the configuration model, the clustering coefficient is low and decreases to zero as the network size increases. This is also observed in many growing network models. However, many real-world networks exhibit a high clustering coefficient that remains constant even for large network sizes.\n",
"\n",
2 years ago
"> This phenomenon led to the introduction of the small-world model `[3]`, which combines the properties of a regular lattice with high clustering and a random graph.\n",
"\n",
"---\n",
"\n",
2 years ago
"The library `networkx` provides a function to compute the clustering coefficient of a graph."
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Computing average clustering coefficient for the Brightkite Checkins Graph...\n",
"\tAverage clustering coefficient: 0.7139988006862793\n",
"\tCPU time: 13.7 seconds\n",
"\n",
"Computing average clustering coefficient for the Gowalla Checkins Graph...\n",
"\tAverage clustering coefficient: 0.5483724940778376\n",
"\tCPU time: 1.5 seconds\n",
"\n",
"Computing average clustering coefficient for the Foursquare Checkins Graph...\n",
"\tAverage clustering coefficient: 0.6527297407924693\n",
"\tCPU time: 17.5 seconds\n",
"\n",
"Computing average clustering coefficient for the Brightkite Friendship Graph...\n",
"\tAverage clustering coefficient: 0.07238126177648738\n",
"\tCPU time: 0.0 seconds\n",
"\n",
"Computing average clustering coefficient for the Gowalla Friendship Graph...\n",
"\tAverage clustering coefficient: 0.15971676222947884\n",
"\tCPU time: 0.0 seconds\n",
"\n",
"Computing average clustering coefficient for the Foursquare Friendship Graph...\n",
"\tAverage clustering coefficient: 0.18348521948916247\n",
"\tCPU time: 0.0 seconds\n"
]
},
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Graph</th>\n",
" <th>Average Clustering Coefficient</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Brightkite Checkins Graph</td>\n",
" <td>0.713999</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Gowalla Checkins Graph</td>\n",
" <td>0.548372</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Foursquare Checkins Graph</td>\n",
" <td>0.65273</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Brightkite Friendship Graph</td>\n",
" <td>0.072381</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Gowalla Friendship Graph</td>\n",
" <td>0.159717</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>Foursquare Friendship Graph</td>\n",
" <td>0.183485</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Graph Average Clustering Coefficient\n",
"0 Brightkite Checkins Graph 0.713999\n",
"1 Gowalla Checkins Graph 0.548372\n",
"2 Foursquare Checkins Graph 0.65273\n",
"3 Brightkite Friendship Graph 0.072381\n",
"4 Gowalla Friendship Graph 0.159717\n",
"5 Foursquare Friendship Graph 0.183485"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"for graph in graphs_all:\n",
" print(\"\\nComputing average clustering coefficient for the {}...\".format(graph.name))\n",
" start = time.time()\n",
" avg_clustering = nx.average_clustering(graph)\n",
" end = time.time()\n",
" print(\"\\tAverage clustering coefficient: {}\".format(avg_clustering))\n",
" print(\"\\tCPU time: \" + str(round(end-start,1)) + \" seconds\")\n",
" analysis_results.loc[analysis_results['Graph'] == graph.name, 'Average Clustering Coefficient'] = avg_clustering\n",
"\n",
"analysis_results[['Graph', 'Average Clustering Coefficient']]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## <a id='toc4_3_'></a>[Average Path Length](#toc0_)\n",
"\n",
2 years ago
"In the context of our network analysis, it is important to note that networks are not embedded in physical space and thus, the geometrical distance between nodes becomes irrelevant. Instead, the most pertinent measure of distance in such networks is the minimal number of hops, also known as the chemical distance. This distance between two nodes is defined as the number of edges in the shortest path connecting the nodes.\n",
"\n",
"--- \n",
"\n",
2 years ago
"The `networkx` library offers the `average_shortest_path_length` function to calculate the average shortest path length of a graph. However, there are certain limitations to this function. It is only applicable to connected graphs and there is a chance that the subsample of the dataset used may not be connected. Additionally, this operation can be computationally expensive. The average shortest path length is calculated using the formula:\n",
"\n",
"$$ a = \\sum_{s \\in V} \\sum_{t \\in V} \\frac{d(s,t)}{n(n-1)} $$\n",
"\n",
2 years ago
"where $V$ represents the set of nodes in the graph, $n$ represents the number of nodes, and $d(s,t)$ is the shortest path length between nodes $s$ and $t$. The default algorithm used to calculate the shortest path length is the Dijkstra algorithm.\n",
"\n",
"Given the size of the datasets, computing the average shortest path length for the entire graph is not feasible. To overcome this, we can use the `average_shortest_path` function from the utils module to compute the average shortest path length of a random subsample of the graph. This function requires the input of the networkx graph object and an optional parameter `k` which represents the percentage of nodes to remove from the graph. If `k` is set to `None`, the average shortest path length of each connected component is calculated using all the nodes of the component. The function returns the average shortest path length of the graph.\n",
"\n",
2 years ago
"The implementation involves first removing a random subsample of nodes from the graph, creating a list of connected components with at least 10 nodes, and then using the `average_shortest_path_length` function to calculate the average shortest path length. The choice of 10 nodes is arbitrary and based on empirical observations, as small communities with low average shortest path lengths can skew results. The value of `k` can be adjusted based on the available computing resources and time, with lower values providing more precise results but taking longer to compute and vice versa. However, in this case, the computation time is not overly excessive, so if we are willing to wait a few minutes, we can use the default value of `k` which is `None`.\n",
"\n",
"\n",
"<!-- We have seen how we can characterize the clustering in a small world network. Now we can see the second important property of small-world networks is their small diameter, i.e., the small distance between nodes in the network. The distance in the underlying lattice behaves as the linear length of the lattice, L. Since $N \\sim L^d$ where $d$ is the lattice dimension, it follows that the distance between nodes behaves as:\n",
"\n",
"\\begin{equation}\n",
" l \\sim L \\sim N^{1/d}\n",
"\\end{equation}\n",
"\n",
"Therefore, the underlying lattice has a finite dimension, and the distances on it behave as a power law of the number of nodes, i.e., the distance between nodes is large. However, when adding even a small fraction of shortcuts to the network, this behavior changes dramatically. \n",
"\n",
"Let's try to deduce the behavior of the average distance between nodes. Consider a small-world network, with dimension d and connecting distance $k$ (i.e., every node is connected to any other node whose distance from it in every linear dimension is at most $k$). Now, consider the nodes reachable from a source node with at most $r$ steps. When $r$ is small, these are just the \\emph{r-th} nearest neighbors of the source in the underlying lattice. We term the set of these neighbors a “patch”. the radius of which is $kr$ , and the number of nodes it contains is approximately $n(r) = (2kr)d$. \n",
"\n",
"We now want to find the distance r for which such a patch will contain about one shortcut. This will allow us to consider this patch as if it was a single node in a randomly connected network. Assume that the probability for a single node to have a shortcut is $\\Phi$. To find the length for which approximately one shortcut is encountered, we need to solve for $r$ the following equation: $(2kr)^d \\Phi = 1$. The correlation length $\\xi$ defined as the distance (or linear size of a patch) for which a shortcut will be encountered with high probability is therefore,\n",
"\n",
"\\begin{equation}\n",
" \\xi = \\frac{1}{k \\Phi^{1/d}}\n",
"\\end{equation}\n",
"\n",
"Note that we have omitted the factor 2, since we are interested in the order of magnitude. Let us denote by $V(r)$ the total number of nodes reachable from a node by at most $r$ steps, and by $a(r)$, the number of nodes added to a patch in the \\emph{r-th} step. That is, $a(r) = n(r) - n(r-1)$. Thus,\n",
"\n",
"\\begin{equation}\n",
" a(r) \\sim \\frac{\\text{d} n(r)}{\\text{d} r} = 2kd(2kr)^{d-1}\n",
"\\end{equation}\n",
"\n",
"When a shortcut is encountered at the r step from a node, it leads to a new patch \\footnote{It may actually lead to an already encountered patch, and two patches may also merge after some steps, but this occurs with negligible probability when $N \\to \\infty$ until most of the network is reachable}. This new patch occurs after $r'$ steps, and therefore the number of nodes reachable from its origin is $V (r - r')$. Thus, we obtain the recursive relation\n",
"\n",
"\\begin{equation} \n",
" V(r) = \\sum_{r'=0}^r a(r') [1 + \\xi^{-d}V(r-r')]\n",
"\\end{equation}\n",
"\n",
"where the first term stands for the size of the original patch, and the second term is derived from the probability of hitting a shortcut, which is approximately $\\xi -d $ for every new node encountered. To simplify the solution of \\ref{eq:recursion}, it can be approximated by a differential equation. The sum can be approximated by an integral, and then the equation can be differentiated with respect to $r$ . For simplicity, we will concentrate here on the solution for the one-dimensional case, with $k = 1$, where $a(r) = 2$. Thus, one obtains\n",
"\n",
"\\begin{equation}\n",
" \\frac{\\text{d} V(r)}{\\text{d} r} = 2 [1 + V(r)/\\xi]\n",
"\\end{equation}\n",
"\n",
"the solution of which is:\n",
"\n",
"\\begin{equation} \n",
" V(r) = \\xi \\left(e^{2r/\\xi} -1\\right)\n",
"\\end{equation}\n",
"\n",
"For $r \\ll \\xi$, the exponent can be expanded in a power series, and one obtains $V(r) \\sim 2r = n(r)$, as expected, since usually no shortcut is encountered. For $r \\ gg \\xi$, $V(r)$. An approximation for the average distance between nodes can be obtained by equating $V(r)$ from \\ref*{eq:V(r)} to the total number of nodes, $V(r) = N$. This results in\n",
"\n",
"\\begin{equation} \n",
" r \\sim \\frac{\\xi}{2} \\ln \\frac{N}{\\xi} \n",
"\\end{equation}\n",
" -->\n"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Computing average shortest path length for graph: Brightkite Checkins Graph\n",
"\tNumber of nodes after removing 50.0% of nodes: 3247\n",
"\tNumber of edges after removing 50.0% of nodes: 72733\n",
"\tNumber of connected components with more then 10 nodes: 1 \n",
"\tAverage shortest path length: 3.12ngth of connected component with 2925 nodes and 72656 edges \n",
"\tCPU time: 14.9 seconds\n",
"\n",
"Computing average shortest path length for graph: Gowalla Checkins Graph\n",
"\tNumber of nodes after removing 50.0% of nodes: 1537\n",
"\tNumber of edges after removing 50.0% of nodes: 15177\n",
"\tNumber of connected components with more then 10 nodes: 1 \n",
"\tAverage shortest path length: 3.73ngth of connected component with 1351 nodes and 15146 edges \n",
"\tCPU time: 2.3 seconds\n",
"\n",
"Computing average shortest path length for graph: Foursquare Checkins Graph\n",
"\tNumber of nodes after removing 50.0% of nodes: 1162\n",
"\tNumber of edges after removing 50.0% of nodes: 58703\n",
"\tNumber of connected components with more then 10 nodes: 1 \n",
"\tAverage shortest path length: 2.21ngth of connected component with 1109 nodes and 58698 edges \n",
"\tCPU time: 3.7 seconds\n",
"\n",
"Computing average shortest path length for graph: Brightkite Friendship Graph\n",
"\tNumber of nodes after removing 50.0% of nodes: 750\n",
"\tNumber of edges after removing 50.0% of nodes: 212\n",
"\tNumber of connected components with more then 10 nodes: 3 \n",
"\tAverage shortest path length: 11.69gth of connected component with 24 nodes and 27 edges \n",
"\tCPU time: 0.0 seconds\n",
"\n",
"Computing average shortest path length for graph: Gowalla Friendship Graph\n",
"\tNumber of nodes after removing 50.0% of nodes: 750\n",
"\tNumber of edges after removing 50.0% of nodes: 580\n",
2 years ago
"\tNumber of connected components with more then 10 nodes: 3 \n",
"\tAverage shortest path length: 11.87gth of connected component with 11 nodes and 11 edges s \n",
"\tCPU time: 0.0 seconds\n",
"\n",
"Computing average shortest path length for graph: Foursquare Friendship Graph\n",
"\tNumber of nodes after removing 50.0% of nodes: 699\n",
"\tNumber of edges after removing 50.0% of nodes: 1636\n",
"\tNumber of connected components with more then 10 nodes: 1 \n",
"\tAverage shortest path length: 3.74ngth of connected component with 468 nodes and 1563 edges \n",
"\tCPU time: 0.2 seconds\n"
]
},
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Graph</th>\n",
" <th>Average Shortest Path Length</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Brightkite Checkins Graph</td>\n",
" <td>3.117784</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Gowalla Checkins Graph</td>\n",
" <td>3.726131</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Foursquare Checkins Graph</td>\n",
" <td>2.213298</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Brightkite Friendship Graph</td>\n",
" <td>11.694492</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Gowalla Friendship Graph</td>\n",
" <td>11.865207</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>Foursquare Friendship Graph</td>\n",
" <td>3.739097</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Graph Average Shortest Path Length\n",
"0 Brightkite Checkins Graph 3.117784\n",
"1 Gowalla Checkins Graph 3.726131\n",
"2 Foursquare Checkins Graph 2.213298\n",
"3 Brightkite Friendship Graph 11.694492\n",
"4 Gowalla Friendship Graph 11.865207\n",
"5 Foursquare Friendship Graph 3.739097"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# if you want just to test it out, leave k = 0.5, it will only take a few seconds. More accurate results will be available to download after\n",
"\n",
"for graph in graphs_all:\n",
" print(\"\\nComputing average shortest path length for graph: \", graph.name)\n",
"\n",
" start = time.time()\n",
" average_shortest_path_length = average_shortest_path(graph, k = 0.5)\n",
" end = time.time()\n",
"\n",
" print(\"\\tAverage shortest path length: {}\".format(round(average_shortest_path_length,2)))\n",
" print(\"\\tCPU time: \" + str(round(end-start,1)) + \" seconds\")\n",
" \n",
" analysis_results.loc[analysis_results['Graph'] == graph.name, 'Average Shortest Path Length'] = average_shortest_path_length\n",
"\n",
"analysis_results[['Graph', 'Average Shortest Path Length']]"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## <a id='toc4_4_'></a>[Betweenness Centrality](#toc0_)\n",
"\n",
2 years ago
"In a network, the significance of a node is dependent on a multitude of factors. The importance of a website could stem from its content while that of a router could stem from its capacity. However, these properties are contingent upon the type of network being studied and may have limited correlation with the graph structure of the network. We are interested on the importance of a node or link in terms of its topological function within the network. It is reasonable to infer that the topology of a network may intrinsically dictate the significance of different nodes. One measure of centrality is the degree of a node, where the higher the degree, the greater the node's connectivity, and thus, its centrality in the network. Nevertheless, the degree is not the sole determinant of a node's significance.\n",
"\n",
2 years ago
"A commonly accepted definition of centrality is based on path counting. For each node, `i`, in the network, the number of routing paths to all other nodes that traverse `i` is counted, and this number determines node `i`'s centrality. The most conventional approach is to consider only the shortest paths as routing paths, resulting in the following definition: the _betweenness centrality_ of node `i`, represented by $g(i)$, is equal to the number of shortest paths between all node pairs in the network that traverse it, as expressed in the equation below:\n",
"\n",
2 years ago
"$$ g(i) = \\sum_{{ j,k }} g_i (j,k) $$\n",
"\n",
2 years ago
"where the notation ${j, k}$ represents the summation of each pair once, ignoring the order, and $g_i(j, k)$ equals $1$ if the shortest path between nodes `j` and `k` passes through node `i` and $0$ otherwise. In networks with no weight, i.e., networks where all edges have the same length, there might be more than one shortest path. In such cases, it is common practice to take $g_i(j, k) = C_i(j,k)/C(j,k)$, where $C(j,k)$ is the number of shortest paths between `j` and `k` and $C_i(j,k)$ is the number of those passing through `i`.\n",
"\n",
2 years ago
"> There are several variations of this scheme, particularly focusing on the counting of distinct shortest paths, if multiple shortest paths share some edges. However, these differences tend to have minimal statistical impact in random complex networks, where the number of short loops is limited. Thus, this project will concentrate on the above definition. Another consideration is whether the source and destination are considered part of the shortest path.\n",
"\n",
"--- \n",
"\n",
"The networkx library includes a function for computing the betweenness centrality of all nodes in a network. This function is based on the algorithm proposed by Ulrik Brandes in `[16]`, which involves the calculation of shortest paths between all pairs of nodes in the network and counting the number of shortest paths that pass through each node.\n",
"\n",
"However, the computation of this algorithm on large networks may not be feasible within a reasonable time frame due to the computational cost. To mitigate this issue we can use a sampling approach can be employed. Nevertheless, even with heavy sampling, the computation time remains prohibitively high. To avoid further sampling, which would introduce bias, we will use a parallelization approach to speed up the computation.\n",
"\n",
2 years ago
"In the `utils` module, I have implemented a function called `betweenness_centrality_parallel` that uses this approach. The function takes as input a networkx graph object, the number of processes to use for computation (default is 1, which uses the standard betweenness algorithm), and the percentage of nodes to remove from the graph (default is `None`, which uses all nodes of the connected component to compute the average shortest path length). The function divides the network into _chunks_ of nodes and computes their contribution to the betweenness centrality of the whole network in parallel, ultimately returning a dictionary of the betweenness centrality of each node.\n",
"\n",
2 years ago
"Please note that for large graphs, it is advisable to not use more than 6 processes to avoid memory constraints. The number of processes to use can be determined based on the available time and the machine being used. For small graphs, more processes may be used. As for the percentage of nodes to remove, lower values provide more precise results but take longer to compute, while higher values result in less precise results but are faster to compute. It is suggested to start with `k=0.6` for a quick test and use `k=0.2` for a more precise result. For more information, refer to the function code in the `utils` module."
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Computing the approximate betweenness centrality for the Brightkite Checkins Graph...\n",
"\n",
"Graph is not connected. Taking the largest connected component\n",
"Number of nodes in the sampled graph: 3895\n",
"Number of edges in the sampled graph: 109595\n",
"\tBetweenness centrality: 0.000571670929493879 \n",
"\tCPU time: 98.5 seconds\n",
"\n",
"Computing the approximate betweenness centrality for the Gowalla Checkins Graph...\n",
"\n",
"Graph is not connected. Taking the largest connected component\n",
"Number of nodes in the sampled graph: 1843\n",
"Number of edges in the sampled graph: 23885\n",
"\tBetweenness centrality: 0.0015210855257160798 \n",
"\tCPU time: 12.7 seconds\n",
"\n",
"Computing the approximate betweenness centrality for the Foursquare Checkins Graph...\n",
"\n",
"Graph is not connected. Taking the largest connected component\n",
"Number of nodes in the sampled graph: 1394\n",
"Number of edges in the sampled graph: 86059\n",
"\tBetweenness centrality: 0.0009135778105161979 \n",
"\tCPU time: 30.7 seconds\n",
"\n",
"Computing the approximate betweenness centrality for the Brightkite Friendship Graph...\n",
"\n",
"Graph is not connected. Taking the largest connected component\n",
"Number of nodes in the sampled graph: 900\n",
"Number of edges in the sampled graph: 381\n",
"\tBetweenness centrality: 0.024814375935463612 \n",
"\tCPU time: 0.3 seconds\n",
"\n",
"Computing the approximate betweenness centrality for the Gowalla Friendship Graph...\n",
"\n",
"Graph is not connected. Taking the largest connected component\n",
"Number of nodes in the sampled graph: 900\n",
"Number of edges in the sampled graph: 797\n",
"\tBetweenness centrality: 0.014602979710672098 \n",
"\tCPU time: 0.4 seconds\n",
"\n",
"Computing the approximate betweenness centrality for the Foursquare Friendship Graph...\n",
"\n",
"Graph is not connected. Taking the largest connected component\n",
"Number of nodes in the sampled graph: 838\n",
"Number of edges in the sampled graph: 1860\n",
"\tBetweenness centrality: 0.00518979036959232 \n",
"\tCPU time: 0.8 seconds\n"
]
},
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Graph</th>\n",
" <th>betweenness centrality</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Brightkite Checkins Graph</td>\n",
" <td>0.000572</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Gowalla Checkins Graph</td>\n",
" <td>0.001521</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Foursquare Checkins Graph</td>\n",
" <td>0.000914</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Brightkite Friendship Graph</td>\n",
" <td>0.024814</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Gowalla Friendship Graph</td>\n",
" <td>0.014603</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>Foursquare Friendship Graph</td>\n",
" <td>0.00519</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Graph betweenness centrality\n",
"0 Brightkite Checkins Graph 0.000572\n",
"1 Gowalla Checkins Graph 0.001521\n",
"2 Foursquare Checkins Graph 0.000914\n",
"3 Brightkite Friendship Graph 0.024814\n",
"4 Gowalla Friendship Graph 0.014603\n",
"5 Foursquare Friendship Graph 0.00519"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"for graph in graphs_all:\n",
" print(\"\\nComputing the approximate betweenness centrality for the {}...\".format(graph.name))\n",
" start = time.time()\n",
" betweenness_centrality = np.mean(list(betweenness_centrality_parallel(graph, 6, k = 0.4).values()))\n",
" end = time.time()\n",
" print(\"\\tBetweenness centrality: {} \".format(betweenness_centrality))\n",
" print(\"\\tCPU time: \" + str(round(end-start,1)) + \" seconds\")\n",
"\n",
" analysis_results.loc[analysis_results['Graph'] == graph.name, 'betweenness centrality'] = betweenness_centrality\n",
"\n",
"analysis_results[['Graph', 'betweenness centrality']]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## <a id='toc4_5_'></a>[Download the dataframe with accurate results](#toc0_)\n",
"\n",
2 years ago
"All the results from the previous section are available in the following dataframe. Each function as been executed using as less sampling as possible, some of them took hours to complete. The dataframe is available in the block below"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Graph</th>\n",
" <th>Number of Nodes</th>\n",
" <th>Number of Edges</th>\n",
" <th>Average Degree</th>\n",
" <th>Average Clustering Coefficient</th>\n",
" <th>log N</th>\n",
" <th>Average Shortest Path Length</th>\n",
" <th>betweenness centrality</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Brightkite Checkins Graph</td>\n",
" <td>6493</td>\n",
" <td>292973</td>\n",
" <td>90.242723</td>\n",
" <td>0.713999</td>\n",
" <td>8.778480</td>\n",
" <td>3.157626</td>\n",
" <td>0.000533</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Gowalla Checkins Graph</td>\n",
" <td>3073</td>\n",
" <td>62790</td>\n",
" <td>40.865604</td>\n",
" <td>0.548372</td>\n",
" <td>8.030410</td>\n",
" <td>3.827384</td>\n",
" <td>0.001395</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Foursquare Checkins Graph</td>\n",
" <td>2324</td>\n",
" <td>246702</td>\n",
" <td>212.30809</td>\n",
" <td>0.65273</td>\n",
" <td>7.751045</td>\n",
" <td>2.217319</td>\n",
" <td>0.000964</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Brightkite Friendship Graph</td>\n",
" <td>1500</td>\n",
" <td>1044</td>\n",
" <td>1.392</td>\n",
" <td>0.080039</td>\n",
" <td>7.313220</td>\n",
" <td>5.921753</td>\n",
" <td>0.000039</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Gowalla Friendship Graph</td>\n",
" <td>1500</td>\n",
" <td>2491</td>\n",
" <td>3.321333</td>\n",
" <td>0.174906</td>\n",
" <td>7.313220</td>\n",
" <td>8.975185</td>\n",
" <td>0.001483</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>Foursquare Friendship Graph</td>\n",
" <td>1397</td>\n",
" <td>5323</td>\n",
" <td>7.620616</td>\n",
" <td>0.183485</td>\n",
" <td>7.242082</td>\n",
" <td>3.868567</td>\n",
" <td>0.001803</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Graph Number of Nodes Number of Edges Average Degree \\\n",
"0 Brightkite Checkins Graph 6493 292973 90.242723 \n",
"1 Gowalla Checkins Graph 3073 62790 40.865604 \n",
"2 Foursquare Checkins Graph 2324 246702 212.30809 \n",
"3 Brightkite Friendship Graph 1500 1044 1.392 \n",
"4 Gowalla Friendship Graph 1500 2491 3.321333 \n",
"5 Foursquare Friendship Graph 1397 5323 7.620616 \n",
"\n",
" Average Clustering Coefficient log N Average Shortest Path Length \\\n",
"0 0.713999 8.778480 3.157626 \n",
"1 0.548372 8.030410 3.827384 \n",
"2 0.65273 7.751045 2.217319 \n",
"3 0.080039 7.313220 5.921753 \n",
"4 0.174906 7.313220 8.975185 \n",
"5 0.183485 7.242082 3.868567 \n",
"\n",
" betweenness centrality \n",
"0 0.000533 \n",
"1 0.001395 \n",
"2 0.000964 \n",
"3 0.000039 \n",
"4 0.001483 \n",
"5 0.001803 "
]
},
"execution_count": 33,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"if not os.path.exists(os.path.join('server_results', 'analysis_results.pkl')):\n",
" print(\"Downloading the analysis results file...\")\n",
"\n",
" if not os.path.exists('server_results'):\n",
" os.mkdir('server_results')\n",
"\n",
" wget.download('https://github.com/lukefleed/small-worlds/raw/main/server_results/analysis_results.pkl', out='server_results/analysis_results.pkl')\n",
"\n",
"analysis_results = pd.read_pickle('server_results/analysis_results.pkl')\n",
"analysis_results.iloc[:, :-1] # we do not need last column for now"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# <a id='toc5_'></a>[Analysis of the results](#toc0_)"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"### <a id='toc5_1_1_'></a>[Distribution of Degree](#toc0_)\n",
"\n",
"In the previous section, we established that a scale-free network exhibits a skewed distribution of node degrees, resulting from a few nodes possessing a significantly higher number of connections compared to the majority of nodes. Such networks contain \"hubs\" or high-degree nodes that play a disproportionate role in the structure and function of the network. On the other hand, a random network showcases a more uniform distribution of node degrees with nodes possessing approximately the same number of connections.\n",
"\n",
"---\n",
"\n",
"We can now determine if our networks are scale-free or not. To this end, we utilize the `degree_distribution` function from the `utils` module to plot the degree distribution of a graph. The function accepts a networkx graph object as input and returns a plot of the degree distribution. We anticipate observing a power-law distribution, rather than a Poissonian distribution."
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
" <script type=\"text/javascript\">\n",
" window.PlotlyConfig = {MathJaxConfig: 'local'};\n",
" if (window.MathJax) {MathJax.Hub.Config({SVG: {font: \"STIX-Web\"}});}\n",
" if (typeof require !== 'undefined') {\n",
" require.undef(\"plotly\");\n",
" define('plotly', function(require, exports, module) {\n",
" /**\n",
"* plotly.js v2.8.3\n",
"* Copyright 2012-2021, Plotly, Inc.\n",
"* All rights reserved.\n",
"* Licensed under the MIT license\n",
"*/\n",
"!function(t){if(\"object\"==typeof exports&&\"undefined\"!=typeof module)module.exports=t();else if(\"function\"==typeof define&&define.amd)define([],t);else{(\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof self?self:this).Plotly=t()}}((function(){return function t(e,r,n){function i(o,s){if(!r[o]){if(!e[o]){var l=\"function\"==typeof require&&require;if(!s&&l)return l(o,!0);if(a)return a(o,!0);var c=new Error(\"Cannot find module '\"+o+\"'\");throw c.code=\"MODULE_NOT_FOUND\",c}var u=r[o]={exports:{}};e[o][0].call(u.exports,(function(t){return i(e[o][1][t]||t)}),u,u.exports,t,e,r,n)}return r[o].exports}for(var a=\"function\"==typeof require&&require,o=0;o<n.length;o++)i(n[o]);return i}({1:[function(t,e,r){\"use strict\";var n=t(\"../src/lib\"),i={\"X,X div\":'direction:ltr;font-family:\"Open Sans\",verdana,arial,sans-serif;margin:0;padding:0;',\"X input,X button\":'font-family:\"Open Sans\",verdana,arial,sans-serif;',\"X input:focus,X button:focus\":\"outline:none;\",\"X a\":\"text-decoration:none;\",\"X a:hover\":\"text-decoration:none;\",\"X .crisp\":\"shape-rendering:crispEdges;\",\"X .user-select-none\":\"-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;\",\"X svg\":\"overflow:hidden;\",\"X svg a\":\"fill:#447adb;\",\"X svg a:hover\":\"fill:#3c6dc5;\",\"X .main-svg\":\"position:absolute;top:0;left:0;pointer-events:none;\",\"X .main-svg .draglayer\":\"pointer-events:all;\",\"X .cursor-default\":\"cursor:default;\",\"X .cursor-pointer\":\"cursor:pointer;\",\"X .cursor-crosshair\":\"cursor:crosshair;\",\"X .cursor-move\":\"cursor:move;\",\"X .cursor-col-resize\":\"cursor:col-resize;\",\"X .cursor-row-resize\":\"cursor:row-resize;\",\"X .cursor-ns-resize\":\"cursor:ns-resize;\",\"X .cursor-ew-resize\":\"cursor:ew-resize;\",\"X .cursor-sw-resize\":\"cursor:sw-resize;\",\"X .cursor-s-resize\":\"cursor:s-resize;\",\"X .cursor-se-resize\":\"cursor:se-resize;\",\"X .cursor-w-resize\":\"cursor:w-resize;\",\"X .cursor-e-resize\":\"cursor:e-resize;\",\"X .cursor-nw-resize\":\"cursor:nw-resize;\",\"X .cursor-n-resize\":\"cursor:n-resize;\",\"X .cursor-ne-resize\":\"cursor:ne-resize;\",\"X .cursor-grab\":\"cursor:-webkit-grab;cursor:grab;\",\"X .modebar\":\"position:absolute;top:2px;right:2px;\",\"X .ease-bg\":\"-webkit-transition:background-color .3s ease 0s;-moz-transition:background-color .3s ease 0s;-ms-transition:background-color .3s ease 0s;-o-transition:background-color .3s ease 0s;transition:background-color .3s ease 0s;\",\"X .modebar--hover>:not(.watermark)\":\"opacity:0;-webkit-transition:opacity .3s ease 0s;-moz-transition:opacity .3s ease 0s;-ms-transition:opacity .3s ease 0s;-o-transition:opacity .3s ease 0s;transition:opacity .3s ease 0s;\",\"X:hover .modebar--hover .modebar-group\":\"opacity:1;\",\"X .modebar-group\":\"float:left;display:inline-block;box-sizing:border-box;padding-left:8px;position:relative;vertical-align:middle;white-space:nowrap;\",\"X .modebar-btn\":\"position:relative;font-size:16px;padding:3px 4px;height:22px;cursor:pointer;line-height:normal;box-sizing:border-box;\",\"X .modebar-btn svg\":\"position:relative;top:2px;\",\"X .modebar.vertical\":\"display:flex;flex-direction:column;flex-wrap:wrap;align-content:flex-end;max-height:100%;\",\"X .modebar.vertical svg\":\"top:-1px;\",\"X .modebar.vertical .modebar-group\":\"display:block;float:none;padding-left:0px;padding-bottom:8px;\",\"X .modebar.vertical .modebar-group .modebar-btn\":\"display:block;text-align:center;\",\"X [data-title]:before,X [data-title]:after\":\"position:absolute;-webkit-transform:translate3d(0, 0, 0);-moz-transform:translate3d(0, 0, 0);-ms-transform:translate3d(0, 0, 0);-o-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0);display:none;opacity:0;z-index:1001;pointer-events:none;top:110%;right:50%;\",\"X [data-title]:hover:before,X [data-title]:hover:after\":\"display:block;opacity:1;\",\"X [data-title]:before\":'content:\"\";position:absolute;background:transparent;border:6px solid transparent;z-index:10
"/*!\n",
" * The buffer module from node.js, for the browser.\n",
" *\n",
" * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>\n",
" * @license MIT\n",
" */function i(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,i=0,a=Math.min(r,n);i<a;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0}function a(t){return r.Buffer&&\"function\"==typeof r.Buffer.isBuffer?r.Buffer.isBuffer(t):!(null==t||!t._isBuffer)}var o=t(\"util/\"),s=Object.prototype.hasOwnProperty,l=Array.prototype.slice,c=\"foo\"===function(){}.name;function u(t){return Object.prototype.toString.call(t)}function f(t){return!a(t)&&(\"function\"==typeof r.ArrayBuffer&&(\"function\"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):!!t&&(t instanceof DataView||!!(t.buffer&&t.buffer instanceof ArrayBuffer))))}var h=e.exports=y,p=/\\s*function\\s+([^\\(\\s]*)\\s*/;function d(t){if(o.isFunction(t)){if(c)return t.name;var e=t.toString().match(p);return e&&e[1]}}function m(t,e){return\"string\"==typeof t?t.length<e?t:t.slice(0,e):t}function g(t){if(c||!o.isFunction(t))return o.inspect(t);var e=d(t);return\"[Function\"+(e?\": \"+e:\"\")+\"]\"}function v(t,e,r,n,i){throw new h.AssertionError({message:r,actual:t,expected:e,operator:n,stackStartFunction:i})}function y(t,e){t||v(t,!0,e,\"==\",h.ok)}function x(t,e,r,n){if(t===e)return!0;if(a(t)&&a(e))return 0===i(t,e);if(o.isDate(t)&&o.isDate(e))return t.getTime()===e.getTime();if(o.isRegExp(t)&&o.isRegExp(e))return t.source===e.source&&t.global===e.global&&t.multiline===e.multiline&&t.lastIndex===e.lastIndex&&t.ignoreCase===e.ignoreCase;if(null!==t&&\"object\"==typeof t||null!==e&&\"object\"==typeof e){if(f(t)&&f(e)&&u(t)===u(e)&&!(t instanceof Float32Array||t instanceof Float64Array))return 0===i(new Uint8Array(t.buffer),new Uint8Array(e.buffer));if(a(t)!==a(e))return!1;var s=(n=n||{actual:[],expected:[]}).actual.indexOf(t);return-1!==s&&s===n.expected.indexOf(e)||(n.actual.push(t),n.expected.push(e),function(t,e,r,n){if(null==t||null==e)return!1;if(o.isPrimitive(t)||o.isPrimitive(e))return t===e;if(r&&Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;var i=b(t),a=b(e);if(i&&!a||!i&&a)return!1;if(i)return t=l.call(t),e=l.call(e),x(t,e,r);var s,c,u=T(t),f=T(e);if(u.length!==f.length)return!1;for(u.sort(),f.sort(),c=u.length-1;c>=0;c--)if(u[c]!==f[c])return!1;for(c=u.length-1;c>=0;c--)if(s=u[c],!x(t[s],e[s],r,n))return!1;return!0}(t,e,r,n))}return r?t===e:t==e}function b(t){return\"[object Arguments]\"==Object.prototype.toString.call(t)}function _(t,e){if(!t||!e)return!1;if(\"[object RegExp]\"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function w(t,e,r,n){var i;if(\"function\"!=typeof e)throw new TypeError('\"block\" argument must be a function');\"string\"==typeof r&&(n=r,r=null),i=function(t){var e;try{t()}catch(t){e=t}return e}(e),n=(r&&r.name?\" (\"+r.name+\").\":\".\")+(n?\" \"+n:\".\"),t&&!i&&v(i,r,\"Missing expected exception\"+n);var a=\"string\"==typeof n,s=!t&&i&&!r;if((!t&&o.isError(i)&&a&&_(i,r)||s)&&v(i,r,\"Got unwanted exception\"+n),t&&i&&r&&!_(i,r)||!t&&i)throw i}h.AssertionError=function(t){this.name=\"AssertionError\",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=function(t){return m(g(t.actual),128)+\" \"+t.operator+\" \"+m(g(t.expected),128)}(this),this.generatedMessage=!0);var e=t.stackStartFunction||v;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var n=r.stack,i=d(e),a=n.indexOf(\"\\n\"+i);if(a>=0){var o=n.indexOf(\"\\n\",a+1);n=n.substring(o+1)}this.stack=n}}},o.inherits(h.AssertionError,Error),h.fail=v,h.ok=y,h.equal=function(t,e,r){t!=e&&v(t,e,r,\"==\",h.equal)},h.notEqual=function(t,e,r){t==e&&v(t,e,r,\"!=\",h.notEqual)},h.deepEqual=function(t,e,r){x(t,e,!1)||v(t,e,r,\"deepEqual\",h.deepEqual)},h.deepStrictEqual=function(t,e,r){x(t,e,!0)||v(t,e,r,\"deepStrictEqual\",h.deepStrictEqual)},h.notDeepEqual=function(t,e,r){x(t,e,!1)&&v(t,e,r,\"notDeepEqual\",h.notDeepEqual)},h.notDeepStrictEqual=function t(e,r,n){x(e,r,!0)&&v(e,r,n,\"notDeepStrictEqual\",t)},h.strictEqual=function(t,e
"/*!\n",
" * The buffer module from node.js, for the browser.\n",
" *\n",
" * @author Feross Aboukhadijeh <https://feross.org>\n",
" * @license MIT\n",
" */\n",
"\"use strict\";var e=t(\"base64-js\"),n=t(\"ieee754\");r.Buffer=a,r.SlowBuffer=function(t){+t!=t&&(t=0);return a.alloc(+t)},r.INSPECT_MAX_BYTES=50;function i(t){if(t>2147483647)throw new RangeError('The value \"'+t+'\" is invalid for option \"size\"');var e=new Uint8Array(t);return e.__proto__=a.prototype,e}function a(t,e,r){if(\"number\"==typeof t){if(\"string\"==typeof e)throw new TypeError('The \"string\" argument must be of type string. Received type number');return l(t)}return o(t,e,r)}function o(t,e,r){if(\"string\"==typeof t)return function(t,e){\"string\"==typeof e&&\"\"!==e||(e=\"utf8\");if(!a.isEncoding(e))throw new TypeError(\"Unknown encoding: \"+e);var r=0|f(t,e),n=i(r),o=n.write(t,e);o!==r&&(n=n.slice(0,o));return n}(t,e);if(ArrayBuffer.isView(t))return c(t);if(null==t)throw TypeError(\"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type \"+typeof t);if(B(t,ArrayBuffer)||t&&B(t.buffer,ArrayBuffer))return function(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('\"offset\" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('\"length\" is outside of buffer bounds');var n;n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r);return n.__proto__=a.prototype,n}(t,e,r);if(\"number\"==typeof t)throw new TypeError('The \"value\" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return a.from(n,e,r);var o=function(t){if(a.isBuffer(t)){var e=0|u(t.length),r=i(e);return 0===r.length||t.copy(r,0,0,e),r}if(void 0!==t.length)return\"number\"!=typeof t.length||N(t.length)?i(0):c(t);if(\"Buffer\"===t.type&&Array.isArray(t.data))return c(t.data)}(t);if(o)return o;if(\"undefined\"!=typeof Symbol&&null!=Symbol.toPrimitive&&\"function\"==typeof t[Symbol.toPrimitive])return a.from(t[Symbol.toPrimitive](\"string\"),e,r);throw new TypeError(\"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type \"+typeof t)}function s(t){if(\"number\"!=typeof t)throw new TypeError('\"size\" argument must be of type number');if(t<0)throw new RangeError('The value \"'+t+'\" is invalid for option \"size\"')}function l(t){return s(t),i(t<0?0:0|u(t))}function c(t){for(var e=t.length<0?0:0|u(t.length),r=i(e),n=0;n<e;n+=1)r[n]=255&t[n];return r}function u(t){if(t>=2147483647)throw new RangeError(\"Attempt to allocate Buffer larger than maximum size: 0x\"+2147483647..toString(16)+\" bytes\");return 0|t}function f(t,e){if(a.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||B(t,ArrayBuffer))return t.byteLength;if(\"string\"!=typeof t)throw new TypeError('The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(e){case\"ascii\":case\"latin1\":case\"binary\":return r;case\"utf8\":case\"utf-8\":return D(t).length;case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return 2*r;case\"hex\":return r>>>1;case\"base64\":return R(t).length;default:if(i)return n?-1:D(t).length;e=(\"\"+e).toLowerCase(),i=!0}}function h(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return\"\";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return\"\";if((r>>>=0)<=(e>>>=0))return\"\";for(t||(t=\"utf8\");;)switch(t){case\"hex\":return M(this,e,r);case\"utf8\":case\"utf-8\":return T(this,e,r);case\"ascii\":return k(this,e,r);case\"latin1\":case\"binary\":return A(this,e,r);case\"base64\":return w(this,e,r);case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return S(this,e,r);default:if(n)throw new TypeError(\"Unknown encoding: \"+t);t=(t+\"\").toLowerCase(),n=!0}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function d(t,e,r,n,i){if(0===t.length)return-1;if(\"string\"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),N(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}i
"/*! Native Promise Only\n",
" v0.8.1 (c) Kyle Simpson\n",
" MIT License: http://getify.mit-license.org\n",
"*/\n",
"!function(t,r,n){r[t]=r[t]||n(),void 0!==e&&e.exports&&(e.exports=r[t])}(\"Promise\",void 0!==t?t:this,(function(){\"use strict\";var t,e,n,i=Object.prototype.toString,a=void 0!==r?function(t){return r(t)}:setTimeout;try{Object.defineProperty({},\"x\",{}),t=function(t,e,r,n){return Object.defineProperty(t,e,{value:r,writable:!0,configurable:!1!==n})}}catch(e){t=function(t,e,r){return t[e]=r,t}}function o(t,r){n.add(t,r),e||(e=a(n.drain))}function s(t){var e,r=typeof t;return null==t||\"object\"!=r&&\"function\"!=r||(e=t.then),\"function\"==typeof e&&e}function l(){for(var t=0;t<this.chain.length;t++)c(this,1===this.state?this.chain[t].success:this.chain[t].failure,this.chain[t]);this.chain.length=0}function c(t,e,r){var n,i;try{!1===e?r.reject(t.msg):(n=!0===e?t.msg:e.call(void 0,t.msg))===r.promise?r.reject(TypeError(\"Promise-chain cycle\")):(i=s(n))?i.call(n,r.resolve,r.reject):r.resolve(n)}catch(t){r.reject(t)}}function u(t){var e,r=this;if(!r.triggered){r.triggered=!0,r.def&&(r=r.def);try{(e=s(t))?o((function(){var n=new p(r);try{e.call(t,(function(){u.apply(n,arguments)}),(function(){f.apply(n,arguments)}))}catch(t){f.call(n,t)}})):(r.msg=t,r.state=1,r.chain.length>0&&o(l,r))}catch(t){f.call(new p(r),t)}}}function f(t){var e=this;e.triggered||(e.triggered=!0,e.def&&(e=e.def),e.msg=t,e.state=2,e.chain.length>0&&o(l,e))}function h(t,e,r,n){for(var i=0;i<e.length;i++)!function(i){t.resolve(e[i]).then((function(t){r(i,t)}),n)}(i)}function p(t){this.def=t,this.triggered=!1}function d(t){this.promise=t,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function m(t){if(\"function\"!=typeof t)throw TypeError(\"Not a function\");if(0!==this.__NPO__)throw TypeError(\"Not a promise\");this.__NPO__=1;var e=new d(this);this.then=function(t,r){var n={success:\"function\"!=typeof t||t,failure:\"function\"==typeof r&&r};return n.promise=new this.constructor((function(t,e){if(\"function\"!=typeof t||\"function\"!=typeof e)throw TypeError(\"Not a function\");n.resolve=t,n.reject=e})),e.chain.push(n),0!==e.state&&o(l,e),n.promise},this.catch=function(t){return this.then(void 0,t)};try{t.call(void 0,(function(t){u.call(e,t)}),(function(t){f.call(e,t)}))}catch(t){f.call(e,t)}}n=function(){var t,r,n;function i(t,e){this.fn=t,this.self=e,this.next=void 0}return{add:function(e,a){n=new i(e,a),r?r.next=n:t=n,r=n,n=void 0},drain:function(){var n=t;for(t=r=e=void 0;n;)n.fn.call(n.self),n=n.next}}}();var g=t({},\"constructor\",m,!1);return m.prototype=g,t(g,\"__NPO__\",0,!1),t(m,\"resolve\",(function(t){return t&&\"object\"==typeof t&&1===t.__NPO__?t:new this((function(e,r){if(\"function\"!=typeof e||\"function\"!=typeof r)throw TypeError(\"Not a function\");e(t)}))})),t(m,\"reject\",(function(t){return new this((function(e,r){if(\"function\"!=typeof e||\"function\"!=typeof r)throw TypeError(\"Not a function\");r(t)}))})),t(m,\"all\",(function(t){var e=this;return\"[object Array]\"!=i.call(t)?e.reject(TypeError(\"Not an array\")):0===t.length?e.resolve([]):new e((function(r,n){if(\"function\"!=typeof r||\"function\"!=typeof n)throw TypeError(\"Not a function\");var i=t.length,a=Array(i),o=0;h(e,t,(function(t,e){a[t]=e,++o===i&&r(a)}),n)}))})),t(m,\"race\",(function(t){var e=this;return\"[object Array]\"!=i.call(t)?e.reject(TypeError(\"Not an array\")):new e((function(r,n){if(\"function\"!=typeof r||\"function\"!=typeof n)throw TypeError(\"Not a function\");h(e,t,(function(t,e){r(e)}),n)}))})),m}))}).call(this)}).call(this,\"undefined\"!=typeof global?global:\"undefined\"!=typeof self?self:\"undefined\"!=typeof window?window:{},t(\"timers\").setImmediate)},{timers:311}],246:[function(t,e,r){var n=Math.PI,i=c(120);function a(t,e,r,n){return[\"C\",t,e,r,n,r,n]}function o(t,e,r,n,i,a){return[\"C\",t/3+2/3*r,e/3+2/3*n,i/3+2/3*r,a/3+2/3*n,i,a]}function s(t,e,r,a,o,c,u,f,h,p){if(p)T=p[0],k=p[1],_=p[2],w=p[3];else{var d=l(t,e,-o);t=d.x,e=d.y;var m=(t-(f=(d=l(f,h,-o)).x))/2,g=(e-(h=d.y))/2,v=m*m/(r*r)+g*g/(a*a);v>1&&(r*=v=Math.sqrt(v),a*=v);var y=r*r,x=a*a,b=(c==u?-1:1)*Math.sqrt(Math.abs((y*x-y*g*g-x*m*m)/(y*g*g+x*m*m)));b==1/0&&(
"/*\n",
"object-assign\n",
"(c) Sindre Sorhus\n",
"@license MIT\n",
"*/\n",
"\"use strict\";var n=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;function o(t){if(null==t)throw new TypeError(\"Object.assign cannot be called with null or undefined\");return Object(t)}e.exports=function(){try{if(!Object.assign)return!1;var t=new String(\"abc\");if(t[5]=\"de\",\"5\"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e[\"_\"+String.fromCharCode(r)]=r;if(\"0123456789\"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(\"\"))return!1;var n={};return\"abcdefghijklmnopqrst\".split(\"\").forEach((function(t){n[t]=t})),\"abcdefghijklmnopqrst\"===Object.keys(Object.assign({},n)).join(\"\")}catch(t){return!1}}()?Object.assign:function(t,e){for(var r,s,l=o(t),c=1;c<arguments.length;c++){for(var u in r=Object(arguments[c]))i.call(r,u)&&(l[u]=r[u]);if(n){s=n(r);for(var f=0;f<s.length;f++)a.call(r,s[f])&&(l[s[f]]=r[s[f]])}}return l}},{}],248:[function(t,e,r){\"use strict\";function n(t,e){if(\"string\"!=typeof t)return[t];var r=[t];\"string\"==typeof e||Array.isArray(e)?e={brackets:e}:e||(e={});var n=e.brackets?Array.isArray(e.brackets)?e.brackets:[e.brackets]:[\"{}\",\"[]\",\"()\"],i=e.escape||\"___\",a=!!e.flat;n.forEach((function(t){var e=new RegExp([\"\\\\\",t[0],\"[^\\\\\",t[0],\"\\\\\",t[1],\"]*\\\\\",t[1]].join(\"\")),n=[];function a(e,a,o){var s=r.push(e.slice(t[0].length,-t[1].length))-1;return n.push(s),i+s+i}r.forEach((function(t,n){for(var i,o=0;t!=i;)if(i=t,t=t.replace(e,a),o++>1e4)throw Error(\"References have circular dependency. Please, check them.\");r[n]=t})),n=n.reverse(),r=r.map((function(e){return n.forEach((function(r){e=e.replace(new RegExp(\"(\\\\\"+i+r+\"\\\\\"+i+\")\",\"g\"),t[0]+\"$1\"+t[1])})),e}))}));var o=new RegExp(\"\\\\\"+i+\"([0-9]+)\\\\\"+i);return a?r:function t(e,r,n){for(var i,a=[],s=0;i=o.exec(e);){if(s++>1e4)throw Error(\"Circular references in parenthesis\");a.push(e.slice(0,i.index)),a.push(t(r[i[1]],r)),e=e.slice(i.index+i[0].length)}return a.push(e),a}(r[0],r)}function i(t,e){if(e&&e.flat){var r,n=e&&e.escape||\"___\",i=t[0];if(!i)return\"\";for(var a=new RegExp(\"\\\\\"+n+\"([0-9]+)\\\\\"+n),o=0;i!=r;){if(o++>1e4)throw Error(\"Circular references in \"+t);r=i,i=i.replace(a,s)}return i}return t.reduce((function t(e,r){return Array.isArray(r)&&(r=r.reduce(t,\"\")),e+r}),\"\");function s(e,r){if(null==t[r])throw Error(\"Reference \"+r+\"is undefined\");return t[r]}}function a(t,e){return Array.isArray(t)?i(t,e):n(t,e)}a.parse=n,a.stringify=i,e.exports=a},{}],249:[function(t,e,r){\"use strict\";var n=t(\"pick-by-alias\");e.exports=function(t){var e;arguments.length>1&&(t=arguments);\"string\"==typeof t?t=t.split(/\\s/).map(parseFloat):\"number\"==typeof t&&(t=[t]);t.length&&\"number\"==typeof t[0]?e=1===t.length?{width:t[0],height:t[0],x:0,y:0}:2===t.length?{width:t[0],height:t[1],x:0,y:0}:{x:t[0],y:t[1],width:t[2]-t[0]||0,height:t[3]-t[1]||0}:t&&(t=n(t,{left:\"x l left Left\",top:\"y t top Top\",width:\"w width W Width\",height:\"h height W Width\",bottom:\"b bottom Bottom\",right:\"r right Right\"}),e={x:t.left||0,y:t.top||0},null==t.width?t.right?e.width=t.right-e.x:e.width=0:e.width=t.width,null==t.height?t.bottom?e.height=t.bottom-e.y:e.height=0:e.height=t.height);return e}},{\"pick-by-alias\":253}],250:[function(t,e,r){e.exports=function(t){var e=[];return t.replace(i,(function(t,r,i){var o=r.toLowerCase();for(i=function(t){var e=t.match(a);return e?e.map(Number):[]}(i),\"m\"==o&&i.length>2&&(e.push([r].concat(i.splice(0,2))),o=\"l\",r=\"m\"==r?\"l\":\"L\");;){if(i.length==n[o])return i.unshift(r),e.push(i);if(i.length<n[o])throw new Error(\"malformed path data\");e.push([r].concat(i.splice(0,n[o])))}})),e};var n={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},i=/([astvzqmhlc])([^astvzqmhlc]*)/gi;var a=/-?[0-9]*\\.?[0-9]+(?:e[-+]?\\d+)?/gi},{}],251:[function(t,e,r){e.exports=function(t,e){e||(e=[0,\"\"]),t=String(t);var r=parseFloat(t,10);return e[0]=r,e[1]=t.match(/[\\d.\\-\\+]*\\s*(.*)/)[1]||\"\",e}},{}],252:[function(t,e,r){(function(t){(function(){(function(){var r,n,
"/*\n",
" * @copyright 2016 Sean Connelly (@voidqk), http://syntheti.cc\n",
" * @license MIT\n",
" * @preserve Project Home: https://github.com/voidqk/polybooljs\n",
" */\n",
"var n,i=t(\"./lib/build-log\"),a=t(\"./lib/epsilon\"),o=t(\"./lib/intersecter\"),s=t(\"./lib/segment-chainer\"),l=t(\"./lib/segment-selector\"),c=t(\"./lib/geojson\"),u=!1,f=a();function h(t,e,r){var i=n.segments(t),a=n.segments(e),o=r(n.combine(i,a));return n.polygon(o)}n={buildLog:function(t){return!0===t?u=i():!1===t&&(u=!1),!1!==u&&u.list},epsilon:function(t){return f.epsilon(t)},segments:function(t){var e=o(!0,f,u);return t.regions.forEach(e.addRegion),{segments:e.calculate(t.inverted),inverted:t.inverted}},combine:function(t,e){return{combined:o(!1,f,u).calculate(t.segments,t.inverted,e.segments,e.inverted),inverted1:t.inverted,inverted2:e.inverted}},selectUnion:function(t){return{segments:l.union(t.combined,u),inverted:t.inverted1||t.inverted2}},selectIntersect:function(t){return{segments:l.intersect(t.combined,u),inverted:t.inverted1&&t.inverted2}},selectDifference:function(t){return{segments:l.difference(t.combined,u),inverted:t.inverted1&&!t.inverted2}},selectDifferenceRev:function(t){return{segments:l.differenceRev(t.combined,u),inverted:!t.inverted1&&t.inverted2}},selectXor:function(t){return{segments:l.xor(t.combined,u),inverted:t.inverted1!==t.inverted2}},polygon:function(t){return{regions:s(t.segments,f,u),inverted:t.inverted}},polygonFromGeoJSON:function(t){return c.toPolygon(n,t)},polygonToGeoJSON:function(t){return c.fromPolygon(n,f,t)},union:function(t,e){return h(t,e,n.selectUnion)},intersect:function(t,e){return h(t,e,n.selectIntersect)},difference:function(t,e){return h(t,e,n.selectDifference)},differenceRev:function(t,e){return h(t,e,n.selectDifferenceRev)},xor:function(t,e){return h(t,e,n.selectXor)}},\"object\"==typeof window&&(window.PolyBool=n),e.exports=n},{\"./lib/build-log\":255,\"./lib/epsilon\":256,\"./lib/geojson\":257,\"./lib/intersecter\":258,\"./lib/segment-chainer\":260,\"./lib/segment-selector\":261}],255:[function(t,e,r){e.exports=function(){var t,e=0,r=!1;function n(e,r){return t.list.push({type:e,data:r?JSON.parse(JSON.stringify(r)):void 0}),t}return t={list:[],segmentId:function(){return e++},checkIntersection:function(t,e){return n(\"check\",{seg1:t,seg2:e})},segmentChop:function(t,e){return n(\"div_seg\",{seg:t,pt:e}),n(\"chop\",{seg:t,pt:e})},statusRemove:function(t){return n(\"pop_seg\",{seg:t})},segmentUpdate:function(t){return n(\"seg_update\",{seg:t})},segmentNew:function(t,e){return n(\"new_seg\",{seg:t,primary:e})},segmentRemove:function(t){return n(\"rem_seg\",{seg:t})},tempStatus:function(t,e,r){return n(\"temp_status\",{seg:t,above:e,below:r})},rewind:function(t){return n(\"rewind\",{seg:t})},status:function(t,e,r){return n(\"status\",{seg:t,above:e,below:r})},vert:function(e){return e===r?t:(r=e,n(\"vert\",{x:e}))},log:function(t){return\"string\"!=typeof t&&(t=JSON.stringify(t,!1,\" \")),n(\"log\",{txt:t})},reset:function(){return n(\"reset\")},selected:function(t){return n(\"selected\",{segs:t})},chainStart:function(t){return n(\"chain_start\",{seg:t})},chainRemoveHead:function(t,e){return n(\"chain_rem_head\",{index:t,pt:e})},chainRemoveTail:function(t,e){return n(\"chain_rem_tail\",{index:t,pt:e})},chainNew:function(t,e){return n(\"chain_new\",{pt1:t,pt2:e})},chainMatch:function(t){return n(\"chain_match\",{index:t})},chainClose:function(t){return n(\"chain_close\",{index:t})},chainAddHead:function(t,e){return n(\"chain_add_head\",{index:t,pt:e})},chainAddTail:function(t,e){return n(\"chain_add_tail\",{index:t,pt:e})},chainConnect:function(t,e){return n(\"chain_con\",{index1:t,index2:e})},chainReverse:function(t){return n(\"chain_rev\",{index:t})},chainJoin:function(t,e){return n(\"chain_join\",{index1:t,index2:e})},done:function(){return n(\"done\")}}}},{}],256:[function(t,e,r){e.exports=function(t){\"number\"!=typeof t&&(t=1e-10);var e={epsilon:function(e){return\"number\"==typeof e&&(t=e),t},pointAboveOrOnLine:function(e,r,n){var i=r[0],a=r[1],o=n[0],s=n[1],l=e[0];return(o-i)*(e[1]-a)-(s-a)*(l-i)>=-t},pointBetween:function(e,r,n){var i=e[1]-r[1],a=n[0]-r[0],o=e[0]-r[0],s=n[1]-r[1],l=o*a+i*s;return!(l<t)&&!(l-(a*a+s*s)>-t)},pointsSameX:function(e,r){r
"/*!\n",
" * The buffer module from node.js, for the browser.\n",
" *\n",
" * @author Feross Aboukhadijeh <https://feross.org>\n",
" * @license MIT\n",
" */\n",
"\"use strict\";var e=t(\"base64-js\"),n=t(\"ieee754\");r.Buffer=a,r.SlowBuffer=function(t){+t!=t&&(t=0);return a.alloc(+t)},r.INSPECT_MAX_BYTES=50;function i(t){if(t>2147483647)throw new RangeError('The value \"'+t+'\" is invalid for option \"size\"');var e=new Uint8Array(t);return e.__proto__=a.prototype,e}function a(t,e,r){if(\"number\"==typeof t){if(\"string\"==typeof e)throw new TypeError('The \"string\" argument must be of type string. Received type number');return l(t)}return o(t,e,r)}function o(t,e,r){if(\"string\"==typeof t)return function(t,e){\"string\"==typeof e&&\"\"!==e||(e=\"utf8\");if(!a.isEncoding(e))throw new TypeError(\"Unknown encoding: \"+e);var r=0|f(t,e),n=i(r),o=n.write(t,e);o!==r&&(n=n.slice(0,o));return n}(t,e);if(ArrayBuffer.isView(t))return c(t);if(null==t)throw TypeError(\"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type \"+typeof t);if(B(t,ArrayBuffer)||t&&B(t.buffer,ArrayBuffer))return function(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('\"offset\" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('\"length\" is outside of buffer bounds');var n;n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r);return n.__proto__=a.prototype,n}(t,e,r);if(\"number\"==typeof t)throw new TypeError('The \"value\" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return a.from(n,e,r);var o=function(t){if(a.isBuffer(t)){var e=0|u(t.length),r=i(e);return 0===r.length||t.copy(r,0,0,e),r}if(void 0!==t.length)return\"number\"!=typeof t.length||N(t.length)?i(0):c(t);if(\"Buffer\"===t.type&&Array.isArray(t.data))return c(t.data)}(t);if(o)return o;if(\"undefined\"!=typeof Symbol&&null!=Symbol.toPrimitive&&\"function\"==typeof t[Symbol.toPrimitive])return a.from(t[Symbol.toPrimitive](\"string\"),e,r);throw new TypeError(\"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type \"+typeof t)}function s(t){if(\"number\"!=typeof t)throw new TypeError('\"size\" argument must be of type number');if(t<0)throw new RangeError('The value \"'+t+'\" is invalid for option \"size\"')}function l(t){return s(t),i(t<0?0:0|u(t))}function c(t){for(var e=t.length<0?0:0|u(t.length),r=i(e),n=0;n<e;n+=1)r[n]=255&t[n];return r}function u(t){if(t>=2147483647)throw new RangeError(\"Attempt to allocate Buffer larger than maximum size: 0x\"+2147483647..toString(16)+\" bytes\");return 0|t}function f(t,e){if(a.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||B(t,ArrayBuffer))return t.byteLength;if(\"string\"!=typeof t)throw new TypeError('The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(e){case\"ascii\":case\"latin1\":case\"binary\":return r;case\"utf8\":case\"utf-8\":return D(t).length;case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return 2*r;case\"hex\":return r>>>1;case\"base64\":return R(t).length;default:if(i)return n?-1:D(t).length;e=(\"\"+e).toLowerCase(),i=!0}}function h(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return\"\";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return\"\";if((r>>>=0)<=(e>>>=0))return\"\";for(t||(t=\"utf8\");;)switch(t){case\"hex\":return M(this,e,r);case\"utf8\":case\"utf-8\":return T(this,e,r);case\"ascii\":return k(this,e,r);case\"latin1\":case\"binary\":return A(this,e,r);case\"base64\":return w(this,e,r);case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return S(this,e,r);default:if(n)throw new TypeError(\"Unknown encoding: \"+t);t=(t+\"\").toLowerCase(),n=!0}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function d(t,e,r,n,i){if(0===t.length)return-1;if(\"string\"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),N(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}i
"/*!\n",
" * Determine if an object is a Buffer\n",
" *\n",
" * @author Feross Aboukhadijeh <https://feross.org>\n",
" * @license MIT\n",
" */\n",
"e.exports=function(t){return null!=t&&(n(t)||function(t){return\"function\"==typeof t.readFloatLE&&\"function\"==typeof t.slice&&n(t.slice(0,0))}(t)||!!t._isBuffer)}},{}],238:[function(t,e,r){\"use strict\";e.exports=a,e.exports.isMobile=a,e.exports.default=a;var n=/(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series[46]0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,i=/(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series[46]0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino|android|ipad|playbook|silk/i;function a(t){t||(t={});var e=t.ua;if(e||\"undefined\"==typeof navigator||(e=navigator.userAgent),e&&e.headers&&\"string\"==typeof e.headers[\"user-agent\"]&&(e=e.headers[\"user-agent\"]),\"string\"!=typeof e)return!1;var r=t.tablet?i.test(e):n.test(e);return!r&&t.tablet&&t.featureDetect&&navigator&&navigator.maxTouchPoints>1&&-1!==e.indexOf(\"Macintosh\")&&-1!==e.indexOf(\"Safari\")&&(r=!0),r}},{}],239:[function(t,e,r){\"use strict\";e.exports=function(t){for(var e,r=t.length,n=0;n<r;n++)if(((e=t.charCodeAt(n))<9||e>13)&&32!==e&&133!==e&&160!==e&&5760!==e&&6158!==e&&(e<8192||e>8205)&&8232!==e&&8233!==e&&8239!==e&&8287!==e&&8288!==e&&12288!==e&&65279!==e)return!1;return!0}},{}],240:[function(t,e,r){e.exports=function(t,e,r){return t*(1-r)+e*r}},{}],241:[function(t,e,r){var n=t(\"./normalize\"),i=t(\"gl-mat4/create\"),a=t(\"gl-mat4/clone\"),o=t(\"gl-mat4/determinant\"),s=t(\"gl-mat4/invert\"),l=t(\"gl-mat4/transpose\"),c={length:t(\"gl-vec3/length\"),normalize:t(\"gl-vec3/normalize\"),dot:t(\"gl-vec3/dot\"),cross:t(\"gl-vec3/cross\")},u=i(),f=i(),h=[0,0,0,0],p=[[0,0,0],[0,0,0],[0,0,0]],d=[0,0,0];function m(t,e,r,n,i){t[0]=e[0]*n+r[0]*i,t[1]=e[1]*n+r[1]*i,t[2]=e[2]*n+r[2]*i}e.exports=function(t,e,r,i,g,v){if(e||(e=[0,0,0]),r||(r=[0,0,0]),i||(i=[0,0,0]),g||(g=[0,0,0,1]),v||(v=[0,0,0,1]),!n(u,t))return!1;if(a(f,u),f[3]=0,f[7]=0,f[11]=0,f[15]=1,Math.abs(o(f)<1e-8))return!1;var y,x,b,_,w,T,k,A=u[3],M=u[7],S=u[11],E=u[12],L=u[13],C=u[14],P=u[15];if(0!==A||0!==M||0!==S){if(h[0]=A,h[1]=M,h[2]=S,h[3]=P,!s(f,f))return!1;l(f,f),y=g,b=f,_=(x=h)[0],w=x[1],T=x[2],k=x[3],y[0]=b[0]*_+b[4]*w+b[8]*T+b[12]*k,y[1]=b[1]*_+b[5]*w+b[9]*T+b[13]*k,y[2]=b[2]*_+b[6]*w+b[10]*T+b[14]*k,y[3]=b[3]*_+b[7]*w+b[11]*T+b[15]*k}else g[0]=g[1]=g[2]=0,g[3]=1;if(e[0]=E,e[1]=L,e[2]=C,function(t,e){t[0][0]=e[0],t[0][1]=e[1],t[0][2]=e[2],t[1][0]=e[4],t[1][1]=e[5],t[1][2]=e[6],t[2][0]=e[8],t[2][1]=e[9],t[2][2]=e[10]}(p,u),r[0]=c.length(p[0]),c.normalize(p[0],p[0]),i[0]=c.dot(p[0],p[1]),m(p[1],p[1],p[0],1,-i[0]),r[1]=c.length(p[1]),c.normalize(p[1],p[1]),i[0]/=r[1],i[1]=c.dot(p[0],p[2]),m(p[2],p[2],p[0],1,-i[1]),i[2]=c.dot(p[1],p[2]),m(p[2],p[2],p[1],1,-i[2]),r[2]=c.length(p[2]),c.normalize(p[2],p[2]),i[1]/=r[2],i[2]/=r[2],c.cross(d,p[1],p[2]),c.dot(p[0],d)<0)for(var I=0;I<3;I++)r[I]*=-1,p[I][0]*=-1,p[I][1]*=-1,p[I][2]*=-1;return v[0]=.5*Math.sqrt(Math.max(1+p[0][0]-p[1][1]-p[2][2],0)),v[1]=.5*Math.sqrt(Math.max(1-p[0][0]+p[1][1]-p[2][2],0)),v[2]=.5*Math.sqrt(Math.max(1-p[0][0]-p[1][1]+p[2][2],0)),v[3]=.5*Math.sqrt(Math.max(1+p[0][0]+p[1][1]+p[2][2],0)),p[2][1]>p[1][2]&&(v[0]=-v[0]),p[0][2]>p[2][0]&&(v[1]=-v[1]),p[1][0]>p[0][1]&&(v[2]=-v[2]),!0}},{\"./normalize\":242,\"gl-mat4/clone\":92,\"gl-mat4/create\":93,\"gl-mat4/determinant\":94,\"gl-mat4/invert\":98,\"gl-mat4/transpose\":109,\"gl-vec3/cross\":157,\"gl-vec3/dot\":162,\"gl-vec3/length\":172,\"gl-vec3/normalize\":179}],242:[function(t,e,r){e.exports=function(t,e){var r=e[15];if(0===r)return!1;for(var n=1/r,i=0;i<16;i++)t[i]=e[i]*n;return!0}},{}],243:[function(t,e,r){var n=t(\"gl-vec3/lerp\"),i=t(\"mat4-recompose\"),a=t(\"mat4-decompose\"),o=t(\"gl-mat4/determinant\"),s=t(\"
"/*!\n",
" * pad-left <https://github.com/jonschlinkert/pad-left>\n",
" *\n",
" * Copyright (c) 2014-2015, Jon Schlinkert.\n",
" * Licensed under the MIT license.\n",
" */\n",
"\"use strict\";var n=t(\"repeat-string\");e.exports=function(t,e,r){return n(r=void 0!==r?r+\"\":\" \",e)+t}},{\"repeat-string\":277}],265:[function(t,e,r){e.exports=function(t,e){e||(e=[0,\"\"]),t=String(t);var r=parseFloat(t,10);return e[0]=r,e[1]=t.match(/[\\d.\\-\\+]*\\s*(.*)/)[1]||\"\",e}},{}],266:[function(t,e,r){\"use strict\";e.exports=function(t,e){for(var r=0|e.length,i=t.length,a=[new Array(r),new Array(r)],o=0;o<r;++o)a[0][o]=[],a[1][o]=[];for(o=0;o<i;++o){var s=t[o];a[0][s[0]].push(s),a[1][s[1]].push(s)}var l=[];for(o=0;o<r;++o)a[0][o].length+a[1][o].length===0&&l.push([o]);function c(t,e){var r=a[e][t[e]];r.splice(r.indexOf(t),1)}function u(t,r,i){for(var o,s,l,u=0;u<2;++u)if(a[u][r].length>0){o=a[u][r][0],l=u;break}s=o[1^l];for(var f=0;f<2;++f)for(var h=a[f][r],p=0;p<h.length;++p){var d=h[p],m=d[1^f];n(e[t],e[r],e[s],e[m])>0&&(o=d,s=m,l=f)}return i||o&&c(o,l),s}function f(t,r){var i=a[r][t][0],o=[t];c(i,r);for(var s=i[1^r];;){for(;s!==t;)o.push(s),s=u(o[o.length-2],s,!1);if(a[0][t].length+a[1][t].length===0)break;var l=o[o.length-1],f=t,h=o[1],p=u(l,f,!0);if(n(e[l],e[f],e[h],e[p])<0)break;o.push(t),s=u(l,f)}return o}function h(t,e){return e[1]===e[e.length-1]}for(o=0;o<r;++o)for(var p=0;p<2;++p){for(var d=[];a[p][o].length>0;){a[0][o].length;var m=f(o,p);h(0,m)?d.push.apply(d,m):(d.length>0&&l.push(d),d=m)}d.length>0&&l.push(d)}return l};var n=t(\"compare-angle\")},{\"compare-angle\":54}],267:[function(t,e,r){\"use strict\";e.exports=function(t,e){for(var r=n(t,e.length),i=new Array(e.length),a=new Array(e.length),o=[],s=0;s<e.length;++s){var l=r[s].length;a[s]=l,i[s]=!0,l<=1&&o.push(s)}for(;o.length>0;){var c=o.pop();i[c]=!1;var u=r[c];for(s=0;s<u.length;++s){var f=u[s];0==--a[f]&&o.push(f)}}var h=new Array(e.length),p=[];for(s=0;s<e.length;++s)if(i[s]){c=p.length;h[s]=c,p.push(e[s])}else h[s]=-1;var d=[];for(s=0;s<t.length;++s){var m=t[s];i[m[0]]&&i[m[1]]&&d.push([h[m[0]],h[m[1]]])}return[d,p]};var n=t(\"edges-to-adjacency-list\")},{\"edges-to-adjacency-list\":66}],268:[function(t,e,r){\"use strict\";e.exports=function(t,e){var r=c(t,e);t=r[0];for(var f=(e=r[1]).length,h=(t.length,n(t,e.length)),p=0;p<f;++p)if(h[p].length%2==1)throw new Error(\"planar-graph-to-polyline: graph must be manifold\");var d=i(t,e);var m=(d=d.filter((function(t){for(var r=t.length,n=[0],i=0;i<r;++i){var a=e[t[i]],l=e[t[(i+1)%r]],c=o(-a[0],a[1]),u=o(-a[0],l[1]),f=o(l[0],a[1]),h=o(l[0],l[1]);n=s(n,s(s(c,u),s(f,h)))}return n[n.length-1]>0}))).length,g=new Array(m),v=new Array(m);for(p=0;p<m;++p){g[p]=p;var y=new Array(m),x=d[p].map((function(t){return e[t]})),b=a([x]),_=0;t:for(var w=0;w<m;++w)if(y[w]=0,p!==w){for(var T=(H=d[w]).length,k=0;k<T;++k){var A=b(e[H[k]]);if(0!==A){A<0&&(y[w]=1,_+=1);continue t}}y[w]=1,_+=1}v[p]=[_,p,y]}v.sort((function(t,e){return e[0]-t[0]}));for(p=0;p<m;++p){var M=(y=v[p])[1],S=y[2];for(w=0;w<m;++w)S[w]&&(g[w]=M)}var E=function(t){for(var e=new Array(t),r=0;r<t;++r)e[r]=[];return e}(m);for(p=0;p<m;++p)E[p].push(g[p]),E[g[p]].push(p);var L={},C=u(f,!1);for(p=0;p<m;++p)for(T=(H=d[p]).length,w=0;w<T;++w){var P=H[w],I=H[(w+1)%T],O=Math.min(P,I)+\":\"+Math.max(P,I);if(O in L){var z=L[O];E[z].push(p),E[p].push(z),C[P]=C[I]=!0}else L[O]=p}function D(t){for(var e=t.length,r=0;r<e;++r)if(!C[t[r]])return!1;return!0}var R=[],F=u(m,-1);for(p=0;p<m;++p)g[p]!==p||D(d[p])?F[p]=-1:(R.push(p),F[p]=0);r=[];for(;R.length>0;){var B=R.pop(),N=E[B];l(N,(function(t,e){return t-e}));var j,U=N.length,V=F[B];if(0===V){var H=d[B];j=[H]}for(p=0;p<U;++p){var q=N[p];if(!(F[q]>=0))if(F[q]=1^V,R.push(q),0===V)D(H=d[q])||(H.reverse(),j.push(H))}0===V&&r.push(j)}return r};var n=t(\"edges-to-adjacency-list\"),i=t(\"planar-dual\"),a=t(\"point-in-big-polygon\"),o=t(\"two-product\"),s=t(\"robust-sum\"),l=t(\"uniq\"),c=t(\"./lib/trim-leaves\");function u(t,e){for(var r=new Array(t),n=0;n<t;++n)r[n]=e;return r}},{\"./lib/trim-leaves\":267,\"edges-to-adjacency-list\":66,\"planar-dual\":266,\"point-in-big-polygon\":269,\"robust-sum\":289,\"two-product\":306,uniq:310}],269:[function(t,e,r){e.exports=function(t){for(var e=t.length,r=[]
"/*!\n",
" * repeat-string <https://github.com/jonschlinkert/repeat-string>\n",
" *\n",
" * Copyright (c) 2014-2015, Jon Schlinkert.\n",
" * Licensed under the MIT License.\n",
" */\n",
"\"use strict\";var n,i=\"\";e.exports=function(t,e){if(\"string\"!=typeof t)throw new TypeError(\"expected a string\");if(1===e)return t;if(2===e)return t+t;var r=t.length*e;if(n!==t||void 0===n)n=t,i=\"\";else if(i.length>=r)return i.substr(0,r);for(;r>i.length&&e>1;)1&e&&(i+=t),e>>=1,t+=t;return i=(i+=t).substr(0,r)}},{}],278:[function(t,e,r){(function(t){(function(){e.exports=t.performance&&t.performance.now?function(){return performance.now()}:Date.now||function(){return+new Date}}).call(this)}).call(this,void 0!==n?n:\"undefined\"!=typeof self?self:\"undefined\"!=typeof window?window:{})},{}],279:[function(t,e,r){\"use strict\";e.exports=function(t){for(var e=t.length,r=t[t.length-1],n=e,i=e-2;i>=0;--i){var a=r,o=t[i];(l=o-((r=a+o)-a))&&(t[--n]=r,r=l)}var s=0;for(i=n;i<e;++i){var l;a=t[i];(l=(o=r)-((r=a+o)-a))&&(t[s++]=l)}return t[s++]=r,t.length=s,t}},{}],280:[function(t,e,r){\"use strict\";var n=t(\"two-product\"),i=t(\"robust-sum\"),a=t(\"robust-scale\"),o=t(\"robust-compress\");function s(t,e,r,n){return function(e){return n(t(r(e[0][0],e[1][1]),r(-e[0][1],e[1][0])))}}function l(t,e,r,n){return function(i){return n(t(e(t(r(i[1][1],i[2][2]),r(-i[1][2],i[2][1])),i[0][0]),t(e(t(r(i[1][0],i[2][2]),r(-i[1][2],i[2][0])),-i[0][1]),e(t(r(i[1][0],i[2][1]),r(-i[1][1],i[2][0])),i[0][2]))))}}function c(t){return(2===t?s:3===t?l:void 0)(i,a,n,o)}var u=[function(){return[0]},function(t){return[t[0][0]]}];function f(t,e,r,n,i,a){return function(o){switch(o.length){case 0:return t(o);case 1:return e(o);case 2:return r(o);case 3:return n(o)}var s=i[o.length];return s||(s=i[o.length]=a(o.length)),s(o)}}!function(){for(;u.length<4;)u.push(c(u.length));e.exports=f.apply(void 0,u.concat([u,c]));for(var t=0;t<u.length;++t)e.exports[t]=u[t]}()},{\"robust-compress\":279,\"robust-scale\":286,\"robust-sum\":289,\"two-product\":306}],281:[function(t,e,r){\"use strict\";var n=t(\"two-product\"),i=t(\"robust-sum\");e.exports=function(t,e){for(var r=n(t[0],e[0]),a=1;a<t.length;++a)r=i(r,n(t[a],e[a]));return r}},{\"robust-sum\":289,\"two-product\":306}],282:[function(t,e,r){\"use strict\";var n=t(\"two-product\"),i=t(\"robust-sum\"),a=t(\"robust-subtract\"),o=t(\"robust-scale\");function s(t){return(3===t?l:4===t?c:5===t?u:f)(i,a,n,o)}function l(t,e,r,n){return function(i,a,o){var s=r(i[0],i[0]),l=n(s,a[0]),c=n(s,o[0]),u=r(a[0],a[0]),f=n(u,i[0]),h=n(u,o[0]),p=r(o[0],o[0]),d=n(p,i[0]),m=n(p,a[0]),g=t(e(m,h),e(f,l)),v=e(d,c),y=e(g,v);return y[y.length-1]}}function c(t,e,r,n){return function(i,a,o,s){var l=t(r(i[0],i[0]),r(i[1],i[1])),c=n(l,a[0]),u=n(l,o[0]),f=n(l,s[0]),h=t(r(a[0],a[0]),r(a[1],a[1])),p=n(h,i[0]),d=n(h,o[0]),m=n(h,s[0]),g=t(r(o[0],o[0]),r(o[1],o[1])),v=n(g,i[0]),y=n(g,a[0]),x=n(g,s[0]),b=t(r(s[0],s[0]),r(s[1],s[1])),_=n(b,i[0]),w=n(b,a[0]),T=n(b,o[0]),k=t(t(n(e(T,x),a[1]),t(n(e(w,m),-o[1]),n(e(y,d),s[1]))),t(n(e(w,m),i[1]),t(n(e(_,f),-a[1]),n(e(p,c),s[1])))),A=t(t(n(e(T,x),i[1]),t(n(e(_,f),-o[1]),n(e(v,u),s[1]))),t(n(e(y,d),i[1]),t(n(e(v,u),-a[1]),n(e(p,c),o[1])))),M=e(k,A);return M[M.length-1]}}function u(t,e,r,n){return function(i,a,o,s,l){var c=t(r(i[0],i[0]),t(r(i[1],i[1]),r(i[2],i[2]))),u=n(c,a[0]),f=n(c,o[0]),h=n(c,s[0]),p=n(c,l[0]),d=t(r(a[0],a[0]),t(r(a[1],a[1]),r(a[2],a[2]))),m=n(d,i[0]),g=n(d,o[0]),v=n(d,s[0]),y=n(d,l[0]),x=t(r(o[0],o[0]),t(r(o[1],o[1]),r(o[2],o[2]))),b=n(x,i[0]),_=n(x,a[0]),w=n(x,s[0]),T=n(x,l[0]),k=t(r(s[0],s[0]),t(r(s[1],s[1]),r(s[2],s[2]))),A=n(k,i[0]),M=n(k,a[0]),S=n(k,o[0]),E=n(k,l[0]),L=t(r(l[0],l[0]),t(r(l[1],l[1]),r(l[2],l[2]))),C=n(L,i[0]),P=n(L,a[0]),I=n(L,o[0]),O=n(L,s[0]),z=t(t(t(n(t(n(e(O,E),o[1]),t(n(e(I,T),-s[1]),n(e(S,w),l[1]))),a[2]),t(n(t(n(e(O,E),a[1]),t(n(e(P,y),-s[1]),n(e(M,v),l[1]))),-o[2]),n(t(n(e(I,T),a[1]),t(n(e(P,y),-o[1]),n(e(_,g),l[1]))),s[2]))),t(n(t(n(e(S,w),a[1]),t(n(e(M,v),-o[1]),n(e(_,g),s[1]))),-l[2]),t(n(t(n(e(O,E),a[1]),t(n(e(P,y),-s[1]),n(e(M,v),l[1]))),i[2]),n(t(n(e(O,E),i[1]),t(n(e(C,p),-s[1]),n(e(A,h),l[1]))),-a[2])))),t(t(n(t(n(e(P,y),i[1]),t(n(e(C,p),-a[1]),n(e(m,u),l[1]))),s[2]),t(n(t(n(e(M,v),i[1]),t(n(e(A,h),-a[1]),n(e(m,u),s[1]))),-l[2]),n(t(n(e(S,
" });\n",
" require(['plotly'], function(Plotly) {\n",
" window._Plotly = Plotly;\n",
" });\n",
" }\n",
" </script>\n",
" "
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"name": "Degree Distribution",
"type": "bar",
"x": [
6,
234,
29,
237,
97,
255,
262,
72,
309,
1,
37,
17,
539,
99,
10,
92,
52,
815,
649,
2,
140,
490,
231,
101,
68,
94,
267,
66,
239,
354,
41,
226,
657,
232,
5,
540,
35,
14,
483,
16,
506,
26,
7,
840,
450,
47,
578,
58,
359,
268,
95,
275,
565,
59,
67,
8,
150,
39,
655,
177,
108,
28,
128,
181,
156,
148,
236,
250,
383,
257,
297,
260,
50,
193,
201,
40,
13,
80,
18,
345,
43,
104,
584,
102,
12,
31,
138,
867,
48,
55,
243,
317,
85,
79,
259,
76,
130,
246,
238,
282,
286,
266,
526,
715,
3,
45,
241,
89,
264,
112,
42,
168,
184,
20,
251,
34,
466,
117,
208,
82,
122,
252,
303,
22,
535,
179,
180,
153,
69,
114,
25,
746,
224,
205,
149,
53,
475,
195,
84,
11,
24,
135,
194,
103,
71,
487,
1021,
167,
220,
4,
129,
107,
508,
36,
788,
21,
9,
162,
30,
254,
273,
216,
227,
113,
467,
543,
51,
32,
755,
93,
81,
621,
320,
27,
548,
49,
222,
908,
219,
456,
209,
54,
60,
15,
170,
326,
44,
160,
96,
272,
707,
261,
496,
477,
106,
174,
61,
19,
57,
90,
115,
38,
73,
23,
189,
462,
221,
214,
469,
215,
62,
109,
294,
310,
468,
91,
296,
290,
46,
166,
199,
64,
98,
88,
906,
786,
87,
176,
517,
182,
536,
77,
498,
242,
663,
528,
853,
33,
280,
318,
151,
116,
1043,
110,
671,
803,
480,
678,
142,
738,
65,
493,
321,
716,
161,
126,
211,
218,
292,
187,
384,
674,
169,
198,
197,
131,
253,
591,
100,
229,
311,
541,
499,
173,
230,
1004,
245,
497,
63,
388,
305,
228,
278,
500,
491,
127,
723,
365,
74,
136,
247,
240,
476,
516,
159,
223,
277,
213,
56,
553,
790,
86,
323,
225,
178,
433,
378,
593,
212,
465,
478,
601,
206,
728,
346,
463,
550,
461,
171,
146,
158,
83,
400,
521,
651,
319,
335,
349,
200,
484,
334,
333,
549,
165,
75,
256,
387,
118,
376,
698,
314,
472,
546,
291,
190,
430,
269,
350,
492,
734,
298,
572,
185,
157,
357,
330,
235,
353,
186,
137,
233,
471,
258,
105,
504,
154,
360,
70,
544,
473,
217,
510,
817,
192,
495,
139,
464,
204,
434,
145,
327,
444,
155,
210,
666,
645,
397,
502,
556,
152,
639,
133,
124,
603,
313,
271,
460,
249,
527,
248,
445,
665,
777,
518,
656,
615,
367,
596,
279,
511,
316,
325,
183,
175,
163,
605,
144,
675,
481,
567,
344,
301,
524,
111,
704,
302,
689,
505,
332,
147,
512,
509,
585,
486,
660,
479,
538,
580,
501,
552,
520,
577,
525,
751,
534,
134,
607,
545,
561,
485,
503,
470,
547,
514,
778,
630,
770,
188,
125,
494,
482,
610,
123,
574,
489,
141,
120,
616,
531,
837,
754,
488,
731,
783,
699,
513,
474,
306,
265,
274,
191,
372,
389,
368,
270,
132,
415,
393,
288,
244,
121
],
"y": [
166,
9,
20,
4,
12,
7,
4,
6,
1,
619,
32,
59,
2,
13,
120,
13,
37,
1,
1,
333,
3,
2,
8,
5,
17,
11,
3,
18,
9,
1,
19,
13,
1,
6,
178,
4,
31,
88,
4,
62,
4,
53,
146,
1,
1,
44,
1,
14,
1,
3,
10,
2,
1,
31,
36,
116,
38,
27,
2,
1,
5,
40,
2,
4,
9,
7,
14,
1,
1,
1,
3,
2,
41,
1,
1,
32,
100,
9,
88,
2,
10,
5,
2,
8,
90,
32,
4,
1,
21,
44,
3,
1,
5,
40,
2,
8,
5,
3,
5,
2,
2,
3,
3,
1,
231,
12,
6,
62,
2,
5,
17,
1,
1,
83,
2,
46,
9,
7,
2,
13,
4,
2,
4,
48,
3,
3,
3,
8,
15,
6,
45,
2,
15,
1,
5,
63,
3,
3,
9,
104,
39,
2,
1,
11,
10,
3,
1,
3,
15,
220,
5,
6,
1,
44,
1,
49,
122,
2,
36,
2,
1,
5,
17,
4,
6,
1,
11,
34,
2,
8,
9,
1,
1,
37,
4,
23,
29,
1,
20,
1,
2,
25,
16,
61,
3,
1,
33,
4,
9,
3,
1,
4,
2,
4,
4,
2,
20,
64,
12,
26,
2,
38,
7,
47,
3,
6,
65,
9,
7,
9,
10,
6,
1,
1,
6,
18,
2,
1,
50,
5,
2,
17,
9,
17,
1,
1,
36,
3,
3,
2,
1,
11,
2,
6,
2,
2,
1,
18,
1,
2,
12,
4,
1,
5,
2,
1,
2,
1,
2,
1,
8,
3,
1,
1,
4,
2,
63,
80,
2,
3,
1,
1,
3,
1,
3,
1,
2,
1,
4,
10,
1,
2,
2,
1,
4,
1,
4,
7,
12,
1,
1,
12,
2,
1,
3,
3,
1,
1,
8,
3,
3,
5,
4,
2,
3,
12,
2,
12,
35,
1,
1,
24,
1,
12,
5,
1,
1,
1,
15,
6,
5,
1,
1,
1,
3,
11,
1,
14,
2,
7,
5,
6,
2,
2,
5,
2,
1,
1,
2,
4,
3,
1,
1,
5,
10,
4,
1,
4,
1,
1,
1,
3,
1,
2,
3,
2,
2,
1,
2,
1,
1,
1,
1,
2,
1,
1,
5,
1,
1,
1,
6,
4,
2,
6,
2,
5,
1,
5,
2,
6,
2,
1,
1,
2,
1,
3,
11,
2,
1,
4,
1,
1,
5,
1,
1,
1,
1,
2,
2,
6,
1,
3,
4,
1,
1,
1,
144,
2,
1,
1,
1,
1,
1,
1,
1,
1,
2,
1,
2,
1,
1,
1,
2,
2,
3,
1,
31,
3,
1,
1,
1,
1,
1,
4,
1,
1,
1,
1,
3,
5,
5,
1,
1,
2,
1,
5,
2,
1,
1,
1,
2,
1,
2,
1,
1,
2,
1,
1,
1,
5,
1,
5,
1,
1,
1,
1,
1,
2,
1,
1,
3,
1,
1,
1,
1,
4,
1,
1,
2,
1,
1,
2,
1,
1,
1,
1,
1,
1,
1,
2,
1,
1,
1,
1,
1,
1,
1,
1,
2,
1,
1
]
}
],
"layout": {
"height": 600,
"template": {
"data": {
"bar": [
{
"error_x": {
"color": "#2a3f5f"
},
"error_y": {
"color": "#2a3f5f"
},
"marker": {
"line": {
"color": "white",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "bar"
}
],
"barpolar": [
{
"marker": {
"line": {
"color": "white",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "barpolar"
}
],
"carpet": [
{
"aaxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "#C8D4E3",
"linecolor": "#C8D4E3",
"minorgridcolor": "#C8D4E3",
"startlinecolor": "#2a3f5f"
},
"baxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "#C8D4E3",
"linecolor": "#C8D4E3",
"minorgridcolor": "#C8D4E3",
"startlinecolor": "#2a3f5f"
},
"type": "carpet"
}
],
"choropleth": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "choropleth"
}
],
"contour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "contour"
}
],
"contourcarpet": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "contourcarpet"
}
],
"heatmap": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmap"
}
],
"heatmapgl": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmapgl"
}
],
"histogram": [
{
"marker": {
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "histogram"
}
],
"histogram2d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2d"
}
],
"histogram2dcontour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2dcontour"
}
],
"mesh3d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "mesh3d"
}
],
"parcoords": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "parcoords"
}
],
"pie": [
{
"automargin": true,
"type": "pie"
}
],
"scatter": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter"
}
],
"scatter3d": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter3d"
}
],
"scattercarpet": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattercarpet"
}
],
"scattergeo": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergeo"
}
],
"scattergl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergl"
}
],
"scattermapbox": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattermapbox"
}
],
"scatterpolar": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolar"
}
],
"scatterpolargl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolargl"
}
],
"scatterternary": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterternary"
}
],
"surface": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "surface"
}
],
"table": [
{
"cells": {
"fill": {
"color": "#EBF0F8"
},
"line": {
"color": "white"
}
},
"header": {
"fill": {
"color": "#C8D4E3"
},
"line": {
"color": "white"
}
},
"type": "table"
}
]
},
"layout": {
"annotationdefaults": {
"arrowcolor": "#2a3f5f",
"arrowhead": 0,
"arrowwidth": 1
},
"autotypenumbers": "strict",
"coloraxis": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"colorscale": {
"diverging": [
[
0,
"#8e0152"
],
[
0.1,
"#c51b7d"
],
[
0.2,
"#de77ae"
],
[
0.3,
"#f1b6da"
],
[
0.4,
"#fde0ef"
],
[
0.5,
"#f7f7f7"
],
[
0.6,
"#e6f5d0"
],
[
0.7,
"#b8e186"
],
[
0.8,
"#7fbc41"
],
[
0.9,
"#4d9221"
],
[
1,
"#276419"
]
],
"sequential": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"sequentialminus": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
]
},
"colorway": [
"#636efa",
"#EF553B",
"#00cc96",
"#ab63fa",
"#FFA15A",
"#19d3f3",
"#FF6692",
"#B6E880",
"#FF97FF",
"#FECB52"
],
"font": {
"color": "#2a3f5f"
},
"geo": {
"bgcolor": "white",
"lakecolor": "white",
"landcolor": "white",
"showlakes": true,
"showland": true,
"subunitcolor": "#C8D4E3"
},
"hoverlabel": {
"align": "left"
},
"hovermode": "closest",
"mapbox": {
"style": "light"
},
"paper_bgcolor": "white",
"plot_bgcolor": "white",
"polar": {
"angularaxis": {
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": ""
},
"bgcolor": "white",
"radialaxis": {
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": ""
}
},
"scene": {
"xaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
},
"yaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
},
"zaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
}
},
"shapedefaults": {
"line": {
"color": "#2a3f5f"
}
},
"ternary": {
"aaxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
},
"baxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
},
"bgcolor": "white",
"caxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
}
},
"title": {
"x": 0.05
},
"xaxis": {
"automargin": true,
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "#EBF0F8",
"zerolinewidth": 2
},
"yaxis": {
"automargin": true,
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "#EBF0F8",
"zerolinewidth": 2
}
}
},
"title": {
"text": "Degree Distribution (log-log scale) of Brightkite Checkins Graph"
},
"width": 800,
"xaxis": {
"title": {
"text": "Degree"
},
"type": "log"
},
"yaxis": {
"title": {
"text": "Number of Nodes"
},
"type": "log"
}
}
},
"text/html": [
"<div> <div id=\"663c9408-139f-43de-8c0e-b9509f393b7f\" class=\"plotly-graph-div\" style=\"height:600px; width:800px;\"></div> <script type=\"text/javascript\"> require([\"plotly\"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById(\"663c9408-139f-43de-8c0e-b9509f393b7f\")) { Plotly.newPlot( \"663c9408-139f-43de-8c0e-b9509f393b7f\", [{\"name\":\"Degree Distribution\",\"x\":[6,234,29,237,97,255,262,72,309,1,37,17,539,99,10,92,52,815,649,2,140,490,231,101,68,94,267,66,239,354,41,226,657,232,5,540,35,14,483,16,506,26,7,840,450,47,578,58,359,268,95,275,565,59,67,8,150,39,655,177,108,28,128,181,156,148,236,250,383,257,297,260,50,193,201,40,13,80,18,345,43,104,584,102,12,31,138,867,48,55,243,317,85,79,259,76,130,246,238,282,286,266,526,715,3,45,241,89,264,112,42,168,184,20,251,34,466,117,208,82,122,252,303,22,535,179,180,153,69,114,25,746,224,205,149,53,475,195,84,11,24,135,194,103,71,487,1021,167,220,4,129,107,508,36,788,21,9,162,30,254,273,216,227,113,467,543,51,32,755,93,81,621,320,27,548,49,222,908,219,456,209,54,60,15,170,326,44,160,96,272,707,261,496,477,106,174,61,19,57,90,115,38,73,23,189,462,221,214,469,215,62,109,294,310,468,91,296,290,46,166,199,64,98,88,906,786,87,176,517,182,536,77,498,242,663,528,853,33,280,318,151,116,1043,110,671,803,480,678,142,738,65,493,321,716,161,126,211,218,292,187,384,674,169,198,197,131,253,591,100,229,311,541,499,173,230,1004,245,497,63,388,305,228,278,500,491,127,723,365,74,136,247,240,476,516,159,223,277,213,56,553,790,86,323,225,178,433,378,593,212,465,478,601,206,728,346,463,550,461,171,146,158,83,400,521,651,319,335,349,200,484,334,333,549,165,75,256,387,118,376,698,314,472,546,291,190,430,269,350,492,734,298,572,185,157,357,330,235,353,186,137,233,471,258,105,504,154,360,70,544,473,217,510,817,192,495,139,464,204,434,145,327,444,155,210,666,645,397,502,556,152,639,133,124,603,313,271,460,249,527,248,445,665,777,518,656,615,367,596,279,511,316,325,183,175,163,605,144,675,481,567,344,301,524,111,704,302,689,505,332,147,512,509,585,486,660,479,538,580,501,552,520,577,525,751,534,134,607,545,561,485,503,470,547,514,778,630,770,188,125,494,482,610,123,574,489,141,120,616,531,837,754,488,731,783,699,513,474,306,265,274,191,372,389,368,270,132,415,393,288,244,121],\"y\":[166,9,20,4,12,7,4,6,1,619,32,59,2,13,120,13,37,1,1,333,3,2,8,5,17,11,3,18,9,1,19,13,1,6,178,4,31,88,4,62,4,53,146,1,1,44,1,14,1,3,10,2,1,31,36,116,38,27,2,1,5,40,2,4,9,7,14,1,1,1,3,2,41,1,1,32,100,9,88,2,10,5,2,8,90,32,4,1,21,44,3,1,5,40,2,8,5,3,5,2,2,3,3,1,231,12,6,62,2,5,17,1,1,83,2,46,9,7,2,13,4,2,4,48,3,3,3,8,15,6,45,2,15,1,5,63,3,3,9,104,39,2,1,11,10,3,1,3,15,220,5,6,1,44,1,49,122,2,36,2,1,5,17,4,6,1,11,34,2,8,9,1,1,37,4,23,29,1,20,1,2,25,16,61,3,1,33,4,9,3,1,4,2,4,4,2,20,64,12,26,2,38,7,47,3,6,65,9,7,9,10,6,1,1,6,18,2,1,50,5,2,17,9,17,1,1,36,3,3,2,1,11,2,6,2,2,1,18,1,2,12,4,1,5,2,1,2,1,2,1,8,3,1,1,4,2,63,80,2,3,1,1,3,1,3,1,2,1,4,10,1,2,2,1,4,1,4,7,12,1,1,12,2,1,3,3,1,1,8,3,3,5,4,2,3,12,2,12,35,1,1,24,1,12,5,1,1,1,15,6,5,1,1,1,3,11,1,14,2,7,5,6,2,2,5,2,1,1,2,4,3,1,1,5,10,4,1,4,1,1,1,3,1,2,3,2,2,1,2,1,1,1,1,2,1,1,5,1,1,1,6,4,2,6,2,5,1,5,2,6,2,1,1,2,1,3,11,2,1,4,1,1,5,1,1,1,1,2,2,6,1,3,4,1,1,1,144,2,1,1,1,1,1,1,1,1,2,1,2,1,1,1,2,2,3,1,31,3,1,1,1,1,1,4,1,1,1,1,3,5,5,1,1,2,1,5,2,1,1,1,2,1,2,1,1,2,1,1,1,5,1,5,1,1,1,1,1,2,1,1,3,1,1,1,1,4,1,1,2,1,1,2,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,2,1,1],\"type\":\"bar\"}], {\"template\":{\"data\":{\"barpolar\":[{\"marker\":{\"line\":{\"color\":\"white\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"barpolar\"}],\"bar\":[{\"error_x\":{\"color\":\"#2a3f5f\"},\"error_y\":{\"color\":\"#2a3f5f\"},\"marker\":{\"line\":{\"color\":\"white\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"bar\"}],\"carpet\":[{\"aaxis\":{\"endlinecolor\":\"#2a3f5f\",\"gridcolor\":\
" \n",
"var gd = document.getElementById('663c9408-139f-43de-8c0e-b9509f393b7f');\n",
"var x = new MutationObserver(function (mutations, observer) {{\n",
" var display = window.getComputedStyle(gd).display;\n",
" if (!display || display === 'none') {{\n",
" console.log([gd, 'removed!']);\n",
" Plotly.purge(gd);\n",
" observer.disconnect();\n",
" }}\n",
"}});\n",
"\n",
"// Listen for the removal of the full notebook cells\n",
"var notebookContainer = gd.closest('#notebook-container');\n",
"if (notebookContainer) {{\n",
" x.observe(notebookContainer, {childList: true});\n",
"}}\n",
"\n",
"// Listen for the clearing of the current output cell\n",
"var outputEl = gd.closest('.output');\n",
"if (outputEl) {{\n",
" x.observe(outputEl, {childList: true});\n",
"}}\n",
"\n",
" }) }; }); </script> </div>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"name": "Degree Distribution",
"type": "bar",
"x": [
26,
208,
59,
81,
21,
146,
37,
50,
4,
5,
3,
77,
117,
35,
28,
78,
109,
76,
9,
60,
186,
291,
444,
8,
118,
42,
54,
39,
90,
134,
61,
55,
63,
41,
31,
16,
92,
66,
91,
127,
84,
303,
124,
12,
103,
36,
69,
53,
83,
30,
49,
40,
33,
67,
119,
137,
231,
29,
17,
6,
43,
122,
94,
14,
281,
93,
115,
98,
145,
19,
47,
7,
62,
38,
20,
24,
13,
120,
89,
34,
48,
184,
2,
409,
73,
58,
157,
222,
101,
25,
57,
105,
74,
112,
18,
171,
32,
153,
159,
88,
51,
149,
52,
46,
106,
82,
70,
202,
1,
71,
22,
75,
218,
44,
100,
27,
107,
158,
179,
110,
181,
131,
264,
333,
97,
199,
300,
252,
474,
79,
545,
15,
45,
271,
212,
23,
10,
56,
87,
64,
68,
244,
237,
11,
152,
129,
148,
160,
204,
245,
80,
111,
196,
128,
419,
170,
501,
379,
164,
200,
280,
256,
368,
325,
235,
243,
95,
448,
180,
114,
143,
390,
309,
85,
302,
491,
133,
326,
147,
177,
255,
205,
217,
126,
210,
113,
201,
345,
266,
108,
136,
99,
194,
162,
139,
316,
292,
173,
65,
225,
240,
72,
242,
161,
166,
175,
192,
144,
156,
183,
198,
123,
168,
211,
323,
265,
301,
174,
287,
176,
132,
172,
203,
154,
277,
283,
282,
214,
353,
197,
190,
221,
125,
261,
130,
167,
234,
439,
188,
238,
219,
315,
272,
236,
337,
278,
193,
253,
305,
151,
165,
140,
273,
288,
215,
96,
207,
86,
187,
104,
182,
150,
213,
121,
268,
227
],
"y": [
22,
2,
10,
5,
36,
3,
22,
21,
138,
91,
186,
5,
5,
19,
34,
7,
2,
11,
78,
7,
2,
3,
2,
66,
1,
23,
10,
18,
7,
5,
10,
9,
9,
23,
27,
49,
6,
13,
3,
7,
8,
2,
3,
42,
4,
22,
12,
4,
8,
29,
16,
27,
19,
10,
4,
7,
3,
28,
33,
79,
17,
1,
6,
30,
1,
3,
4,
6,
1,
30,
11,
68,
7,
21,
37,
26,
46,
6,
5,
15,
18,
2,
218,
2,
14,
12,
5,
2,
5,
25,
14,
5,
9,
3,
31,
4,
22,
1,
3,
2,
12,
2,
6,
14,
1,
6,
7,
3,
358,
10,
22,
3,
3,
16,
5,
23,
3,
4,
4,
3,
2,
3,
3,
3,
2,
2,
1,
2,
1,
3,
1,
40,
8,
1,
2,
28,
49,
11,
3,
6,
6,
2,
2,
45,
4,
2,
3,
4,
1,
2,
9,
4,
1,
2,
1,
4,
1,
1,
3,
1,
1,
2,
1,
1,
2,
3,
4,
1,
3,
4,
2,
1,
3,
3,
1,
1,
2,
1,
2,
1,
1,
2,
1,
4,
1,
3,
2,
1,
3,
6,
2,
2,
3,
3,
5,
1,
1,
3,
3,
2,
2,
9,
1,
2,
2,
1,
2,
3,
2,
2,
1,
3,
2,
1,
1,
1,
1,
1,
2,
1,
2,
1,
2,
2,
2,
1,
2,
3,
2,
4,
1,
1,
5,
1,
3,
2,
2,
1,
2,
2,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
2,
1,
1,
1,
1,
1,
1,
3,
1,
3,
1,
2,
1,
4,
1,
1
]
}
],
"layout": {
"height": 600,
"template": {
"data": {
"bar": [
{
"error_x": {
"color": "#2a3f5f"
},
"error_y": {
"color": "#2a3f5f"
},
"marker": {
"line": {
"color": "white",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "bar"
}
],
"barpolar": [
{
"marker": {
"line": {
"color": "white",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "barpolar"
}
],
"carpet": [
{
"aaxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "#C8D4E3",
"linecolor": "#C8D4E3",
"minorgridcolor": "#C8D4E3",
"startlinecolor": "#2a3f5f"
},
"baxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "#C8D4E3",
"linecolor": "#C8D4E3",
"minorgridcolor": "#C8D4E3",
"startlinecolor": "#2a3f5f"
},
"type": "carpet"
}
],
"choropleth": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "choropleth"
}
],
"contour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "contour"
}
],
"contourcarpet": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "contourcarpet"
}
],
"heatmap": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmap"
}
],
"heatmapgl": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmapgl"
}
],
"histogram": [
{
"marker": {
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "histogram"
}
],
"histogram2d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2d"
}
],
"histogram2dcontour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2dcontour"
}
],
"mesh3d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "mesh3d"
}
],
"parcoords": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "parcoords"
}
],
"pie": [
{
"automargin": true,
"type": "pie"
}
],
"scatter": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter"
}
],
"scatter3d": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter3d"
}
],
"scattercarpet": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattercarpet"
}
],
"scattergeo": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergeo"
}
],
"scattergl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergl"
}
],
"scattermapbox": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattermapbox"
}
],
"scatterpolar": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolar"
}
],
"scatterpolargl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolargl"
}
],
"scatterternary": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterternary"
}
],
"surface": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "surface"
}
],
"table": [
{
"cells": {
"fill": {
"color": "#EBF0F8"
},
"line": {
"color": "white"
}
},
"header": {
"fill": {
"color": "#C8D4E3"
},
"line": {
"color": "white"
}
},
"type": "table"
}
]
},
"layout": {
"annotationdefaults": {
"arrowcolor": "#2a3f5f",
"arrowhead": 0,
"arrowwidth": 1
},
"autotypenumbers": "strict",
"coloraxis": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"colorscale": {
"diverging": [
[
0,
"#8e0152"
],
[
0.1,
"#c51b7d"
],
[
0.2,
"#de77ae"
],
[
0.3,
"#f1b6da"
],
[
0.4,
"#fde0ef"
],
[
0.5,
"#f7f7f7"
],
[
0.6,
"#e6f5d0"
],
[
0.7,
"#b8e186"
],
[
0.8,
"#7fbc41"
],
[
0.9,
"#4d9221"
],
[
1,
"#276419"
]
],
"sequential": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"sequentialminus": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
]
},
"colorway": [
"#636efa",
"#EF553B",
"#00cc96",
"#ab63fa",
"#FFA15A",
"#19d3f3",
"#FF6692",
"#B6E880",
"#FF97FF",
"#FECB52"
],
"font": {
"color": "#2a3f5f"
},
"geo": {
"bgcolor": "white",
"lakecolor": "white",
"landcolor": "white",
"showlakes": true,
"showland": true,
"subunitcolor": "#C8D4E3"
},
"hoverlabel": {
"align": "left"
},
"hovermode": "closest",
"mapbox": {
"style": "light"
},
"paper_bgcolor": "white",
"plot_bgcolor": "white",
"polar": {
"angularaxis": {
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": ""
},
"bgcolor": "white",
"radialaxis": {
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": ""
}
},
"scene": {
"xaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
},
"yaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
},
"zaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
}
},
"shapedefaults": {
"line": {
"color": "#2a3f5f"
}
},
"ternary": {
"aaxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
},
"baxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
},
"bgcolor": "white",
"caxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
}
},
"title": {
"x": 0.05
},
"xaxis": {
"automargin": true,
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "#EBF0F8",
"zerolinewidth": 2
},
"yaxis": {
"automargin": true,
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "#EBF0F8",
"zerolinewidth": 2
}
}
},
"title": {
"text": "Degree Distribution (log-log scale) of Gowalla Checkins Graph"
},
"width": 800,
"xaxis": {
"title": {
"text": "Degree"
},
"type": "log"
},
"yaxis": {
"title": {
"text": "Number of Nodes"
},
"type": "log"
}
}
},
"text/html": [
"<div> <div id=\"210ac06d-8779-4afe-a834-be1468d482da\" class=\"plotly-graph-div\" style=\"height:600px; width:800px;\"></div> <script type=\"text/javascript\"> require([\"plotly\"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById(\"210ac06d-8779-4afe-a834-be1468d482da\")) { Plotly.newPlot( \"210ac06d-8779-4afe-a834-be1468d482da\", [{\"name\":\"Degree Distribution\",\"x\":[26,208,59,81,21,146,37,50,4,5,3,77,117,35,28,78,109,76,9,60,186,291,444,8,118,42,54,39,90,134,61,55,63,41,31,16,92,66,91,127,84,303,124,12,103,36,69,53,83,30,49,40,33,67,119,137,231,29,17,6,43,122,94,14,281,93,115,98,145,19,47,7,62,38,20,24,13,120,89,34,48,184,2,409,73,58,157,222,101,25,57,105,74,112,18,171,32,153,159,88,51,149,52,46,106,82,70,202,1,71,22,75,218,44,100,27,107,158,179,110,181,131,264,333,97,199,300,252,474,79,545,15,45,271,212,23,10,56,87,64,68,244,237,11,152,129,148,160,204,245,80,111,196,128,419,170,501,379,164,200,280,256,368,325,235,243,95,448,180,114,143,390,309,85,302,491,133,326,147,177,255,205,217,126,210,113,201,345,266,108,136,99,194,162,139,316,292,173,65,225,240,72,242,161,166,175,192,144,156,183,198,123,168,211,323,265,301,174,287,176,132,172,203,154,277,283,282,214,353,197,190,221,125,261,130,167,234,439,188,238,219,315,272,236,337,278,193,253,305,151,165,140,273,288,215,96,207,86,187,104,182,150,213,121,268,227],\"y\":[22,2,10,5,36,3,22,21,138,91,186,5,5,19,34,7,2,11,78,7,2,3,2,66,1,23,10,18,7,5,10,9,9,23,27,49,6,13,3,7,8,2,3,42,4,22,12,4,8,29,16,27,19,10,4,7,3,28,33,79,17,1,6,30,1,3,4,6,1,30,11,68,7,21,37,26,46,6,5,15,18,2,218,2,14,12,5,2,5,25,14,5,9,3,31,4,22,1,3,2,12,2,6,14,1,6,7,3,358,10,22,3,3,16,5,23,3,4,4,3,2,3,3,3,2,2,1,2,1,3,1,40,8,1,2,28,49,11,3,6,6,2,2,45,4,2,3,4,1,2,9,4,1,2,1,4,1,1,3,1,1,2,1,1,2,3,4,1,3,4,2,1,3,3,1,1,2,1,2,1,1,2,1,4,1,3,2,1,3,6,2,2,3,3,5,1,1,3,3,2,2,9,1,2,2,1,2,3,2,2,1,3,2,1,1,1,1,1,2,1,2,1,2,2,2,1,2,3,2,4,1,1,5,1,3,2,2,1,2,2,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,3,1,3,1,2,1,4,1,1],\"type\":\"bar\"}], {\"template\":{\"data\":{\"barpolar\":[{\"marker\":{\"line\":{\"color\":\"white\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"barpolar\"}],\"bar\":[{\"error_x\":{\"color\":\"#2a3f5f\"},\"error_y\":{\"color\":\"#2a3f5f\"},\"marker\":{\"line\":{\"color\":\"white\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"bar\"}],\"carpet\":[{\"aaxis\":{\"endlinecolor\":\"#2a3f5f\",\"gridcolor\":\"#C8D4E3\",\"linecolor\":\"#C8D4E3\",\"minorgridcolor\":\"#C8D4E3\",\"startlinecolor\":\"#2a3f5f\"},\"baxis\":{\"endlinecolor\":\"#2a3f5f\",\"gridcolor\":\"#C8D4E3\",\"linecolor\":\"#C8D4E3\",\"minorgridcolor\":\"#C8D4E3\",\"startlinecolor\":\"#2a3f5f\"},\"type\":\"carpet\"}],\"choropleth\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"choropleth\"}],\"contourcarpet\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"contourcarpet\"}],\"contour\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"contour\"}],\"heatmapgl\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"heatmapgl\"}],\"heatmap\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0
" \n",
"var gd = document.getElementById('210ac06d-8779-4afe-a834-be1468d482da');\n",
"var x = new MutationObserver(function (mutations, observer) {{\n",
" var display = window.getComputedStyle(gd).display;\n",
" if (!display || display === 'none') {{\n",
" console.log([gd, 'removed!']);\n",
" Plotly.purge(gd);\n",
" observer.disconnect();\n",
" }}\n",
"}});\n",
"\n",
"// Listen for the removal of the full notebook cells\n",
"var notebookContainer = gd.closest('#notebook-container');\n",
"if (notebookContainer) {{\n",
" x.observe(notebookContainer, {childList: true});\n",
"}}\n",
"\n",
"// Listen for the clearing of the current output cell\n",
"var outputEl = gd.closest('.output');\n",
"if (outputEl) {{\n",
" x.observe(outputEl, {childList: true});\n",
"}}\n",
"\n",
" }) }; }); </script> </div>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"name": "Degree Distribution",
"type": "bar",
"x": [
33,
498,
158,
143,
321,
376,
203,
349,
286,
329,
479,
710,
76,
422,
289,
600,
271,
793,
469,
110,
333,
1038,
434,
371,
729,
556,
276,
302,
728,
477,
771,
320,
700,
277,
461,
507,
548,
283,
493,
311,
294,
444,
623,
673,
468,
545,
879,
502,
278,
492,
598,
282,
524,
578,
735,
394,
449,
759,
308,
388,
497,
722,
476,
737,
421,
315,
518,
855,
1061,
313,
335,
392,
620,
454,
280,
828,
406,
432,
381,
383,
856,
544,
327,
696,
512,
564,
312,
346,
674,
792,
796,
521,
474,
443,
466,
370,
712,
859,
368,
340,
970,
395,
606,
316,
854,
345,
689,
336,
781,
279,
553,
360,
378,
486,
653,
331,
420,
314,
902,
829,
299,
632,
403,
355,
292,
484,
570,
281,
920,
409,
325,
412,
431,
428,
347,
440,
773,
318,
941,
705,
823,
485,
552,
363,
362,
652,
319,
875,
451,
483,
359,
944,
310,
585,
684,
339,
334,
495,
642,
893,
305,
562,
467,
780,
622,
789,
560,
456,
288,
455,
487,
337,
442,
536,
969,
373,
344,
768,
482,
567,
624,
803,
917,
475,
905,
857,
1004,
534,
372,
390,
436,
908,
743,
284,
457,
450,
365,
341,
832,
821,
549,
509,
307,
1,
898,
13,
6,
74,
44,
825,
160,
234,
489,
625,
22,
60,
40,
86,
88,
87,
15,
3,
49,
12,
211,
539,
129,
244,
532,
317,
107,
580,
223,
348,
242,
34,
119,
441,
55,
42,
257,
128,
437,
256,
471,
132,
207,
121,
84,
850,
62,
293,
609,
576,
295,
361,
571,
701,
516,
222,
7,
100,
488,
915,
351,
228,
894,
382,
332,
739,
59,
61,
117,
185,
112,
718,
125,
81,
188,
255,
108,
174,
526,
189,
235,
910,
249,
517,
241,
209,
681,
219,
164,
72,
167,
138,
176,
246,
155,
480,
73,
531,
473,
470,
868,
396,
306,
247,
672,
530,
205,
196,
152,
142,
141,
175,
644,
101,
503,
229,
140,
811,
206,
105,
104,
106,
102,
187,
697,
27,
71,
154,
550,
691,
814,
192,
91,
546,
41,
157,
591,
21,
231,
146,
172,
830,
387,
841,
411,
555,
145,
551,
758,
791,
197,
405,
183,
410,
178,
151,
890,
221,
193,
232,
191,
268,
245,
520,
889,
43,
28,
201,
379,
777,
285,
45,
262,
10,
204,
19,
755,
23,
2,
137,
500,
510,
9,
522,
275,
572,
8,
179,
4,
790,
540,
590,
243,
711,
265,
264,
24,
356,
58,
224,
70,
490,
304,
236,
272,
618,
523,
838,
658,
296,
404,
592,
880,
621,
583,
513,
662,
809,
690,
588,
506,
352,
640,
324,
757,
251,
238,
706,
651,
237,
797,
646,
51,
358,
426,
226,
323,
648,
364,
163,
90,
225,
17,
326,
166,
584,
96,
433,
139,
367,
80,
230,
5,
529,
111,
679,
66,
423,
64,
239,
472,
89,
369,
415,
462,
547,
525,
79,
375,
582,
414,
543,
274,
478,
425,
126,
602,
258,
671,
180,
511,
148,
505,
416,
393,
669,
350,
215,
504,
213,
36,
398,
165,
427,
131,
26,
494,
465,
508,
665,
377,
50,
254,
32,
83,
16,
94,
135,
54,
212,
537,
724,
198,
39,
557,
48,
184,
496,
692,
113,
635,
565,
68,
639,
63,
273,
47,
56,
452,
69,
218,
136,
46,
723,
200,
354,
569,
541,
297,
14,
438,
248,
447,
194,
181,
663,
173,
617,
408,
171,
208,
252,
435,
153,
267,
661,
134,
501,
400,
633,
563,
353,
118,
605,
380,
424,
568,
448,
499,
328,
481,
417,
491,
391,
459,
343,
342,
397,
594,
389,
558,
384,
147,
168,
182,
270,
322,
120,
53,
233,
97,
144,
210,
300,
161,
85,
123,
77,
150,
130,
214,
199,
149,
95,
162,
57,
216,
115,
92,
29,
114,
202,
38,
122,
301,
169,
303,
67,
98,
99,
177,
103,
30,
18,
338,
31,
78,
253,
266,
269,
260,
330,
259,
250,
93,
116,
82,
25,
11,
170,
156,
65,
195,
35,
20,
37,
75,
109,
52
],
"y": [
7,
2,
4,
14,
7,
3,
6,
3,
6,
5,
2,
2,
4,
4,
4,
1,
1,
1,
3,
1,
2,
1,
1,
2,
1,
2,
33,
4,
1,
3,
1,
4,
1,
6,
3,
3,
1,
5,
2,
3,
2,
3,
1,
1,
1,
3,
1,
3,
5,
4,
3,
3,
3,
2,
2,
2,
2,
1,
4,
3,
1,
1,
2,
1,
2,
3,
1,
1,
1,
5,
2,
4,
4,
2,
3,
1,
1,
4,
5,
3,
2,
3,
4,
1,
1,
4,
2,
4,
2,
1,
1,
5,
2,
3,
4,
5,
1,
1,
1,
2,
1,
4,
1,
2,
1,
3,
1,
2,
2,
4,
1,
2,
4,
2,
2,
4,
1,
2,
1,
1,
4,
1,
1,
1,
3,
4,
1,
9,
1,
4,
5,
2,
3,
1,
5,
4,
1,
2,
1,
1,
1,
2,
2,
4,
3,
2,
1,
1,
3,
2,
2,
1,
1,
1,
1,
3,
2,
3,
1,
1,
2,
2,
4,
1,
1,
2,
1,
3,
2,
2,
1,
1,
3,
3,
1,
1,
3,
1,
3,
1,
3,
1,
1,
3,
1,
1,
1,
5,
1,
1,
3,
1,
2,
3,
2,
4,
2,
2,
1,
1,
1,
3,
4,
116,
1,
13,
28,
10,
12,
1,
3,
3,
3,
1,
12,
3,
7,
8,
5,
4,
12,
47,
6,
13,
3,
2,
4,
1,
1,
3,
3,
1,
6,
2,
2,
23,
5,
2,
6,
10,
2,
4,
3,
2,
2,
3,
2,
3,
5,
1,
13,
2,
2,
2,
4,
3,
2,
1,
4,
1,
17,
3,
2,
1,
3,
3,
1,
1,
1,
1,
7,
7,
3,
2,
2,
1,
2,
9,
3,
1,
4,
2,
4,
4,
2,
1,
1,
1,
3,
3,
2,
3,
5,
11,
1,
1,
1,
5,
3,
2,
5,
2,
2,
2,
1,
3,
3,
2,
1,
2,
5,
8,
8,
6,
13,
3,
3,
5,
2,
1,
2,
1,
3,
4,
3,
6,
4,
5,
1,
8,
9,
4,
2,
1,
1,
5,
5,
2,
8,
2,
1,
5,
2,
5,
1,
1,
2,
1,
2,
3,
3,
1,
2,
1,
5,
1,
1,
2,
4,
4,
1,
4,
1,
3,
4,
3,
3,
2,
1,
15,
7,
2,
1,
1,
2,
5,
2,
20,
3,
17,
1,
7,
60,
2,
3,
2,
20,
1,
3,
2,
13,
3,
24,
1,
1,
1,
2,
1,
4,
3,
9,
1,
6,
3,
7,
3,
3,
8,
4,
1,
2,
1,
2,
4,
2,
1,
1,
1,
1,
3,
1,
1,
2,
1,
1,
2,
1,
5,
1,
1,
2,
2,
1,
2,
1,
1,
2,
1,
1,
3,
1,
1,
3,
1,
2,
3,
11,
1,
13,
1,
6,
4,
3,
3,
12,
3,
20,
2,
7,
2,
3,
4,
8,
2,
2,
6,
3,
2,
2,
2,
1,
3,
3,
1,
1,
1,
2,
1,
2,
4,
2,
1,
1,
3,
2,
1,
1,
1,
2,
1,
1,
2,
2,
1,
4,
1,
19,
1,
1,
4,
1,
2,
1,
1,
1,
1,
1,
12,
5,
12,
1,
8,
7,
2,
1,
1,
4,
4,
1,
8,
3,
1,
1,
3,
1,
1,
5,
1,
5,
3,
8,
6,
2,
7,
1,
3,
19,
1,
2,
1,
1,
1,
2,
14,
1,
1,
3,
2,
1,
1,
3,
1,
1,
1,
4,
2,
1,
1,
1,
1,
4,
3,
1,
1,
2,
3,
2,
1,
1,
1,
1,
1,
4,
1,
2,
2,
1,
2,
1,
2,
1,
1,
1,
1,
1,
1,
3,
2,
3,
2,
1,
3,
37,
2,
2,
3,
1,
2,
1,
5,
2,
2,
2,
2,
1,
1,
2,
5,
1,
7,
3,
2,
3,
17,
5,
2,
8,
2,
1,
4,
1,
7,
2,
4,
2,
3,
8,
6,
1,
4,
2,
1,
1,
2,
1,
1,
1,
1,
5,
2,
5,
8,
9,
2,
1,
2,
1,
4,
12,
6,
2,
1,
2
]
}
],
"layout": {
"height": 600,
"template": {
"data": {
"bar": [
{
"error_x": {
"color": "#2a3f5f"
},
"error_y": {
"color": "#2a3f5f"
},
"marker": {
"line": {
"color": "white",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "bar"
}
],
"barpolar": [
{
"marker": {
"line": {
"color": "white",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "barpolar"
}
],
"carpet": [
{
"aaxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "#C8D4E3",
"linecolor": "#C8D4E3",
"minorgridcolor": "#C8D4E3",
"startlinecolor": "#2a3f5f"
},
"baxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "#C8D4E3",
"linecolor": "#C8D4E3",
"minorgridcolor": "#C8D4E3",
"startlinecolor": "#2a3f5f"
},
"type": "carpet"
}
],
"choropleth": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "choropleth"
}
],
"contour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "contour"
}
],
"contourcarpet": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "contourcarpet"
}
],
"heatmap": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmap"
}
],
"heatmapgl": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmapgl"
}
],
"histogram": [
{
"marker": {
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "histogram"
}
],
"histogram2d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2d"
}
],
"histogram2dcontour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2dcontour"
}
],
"mesh3d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "mesh3d"
}
],
"parcoords": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "parcoords"
}
],
"pie": [
{
"automargin": true,
"type": "pie"
}
],
"scatter": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter"
}
],
"scatter3d": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter3d"
}
],
"scattercarpet": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattercarpet"
}
],
"scattergeo": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergeo"
}
],
"scattergl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergl"
}
],
"scattermapbox": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattermapbox"
}
],
"scatterpolar": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolar"
}
],
"scatterpolargl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolargl"
}
],
"scatterternary": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterternary"
}
],
"surface": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "surface"
}
],
"table": [
{
"cells": {
"fill": {
"color": "#EBF0F8"
},
"line": {
"color": "white"
}
},
"header": {
"fill": {
"color": "#C8D4E3"
},
"line": {
"color": "white"
}
},
"type": "table"
}
]
},
"layout": {
"annotationdefaults": {
"arrowcolor": "#2a3f5f",
"arrowhead": 0,
"arrowwidth": 1
},
"autotypenumbers": "strict",
"coloraxis": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"colorscale": {
"diverging": [
[
0,
"#8e0152"
],
[
0.1,
"#c51b7d"
],
[
0.2,
"#de77ae"
],
[
0.3,
"#f1b6da"
],
[
0.4,
"#fde0ef"
],
[
0.5,
"#f7f7f7"
],
[
0.6,
"#e6f5d0"
],
[
0.7,
"#b8e186"
],
[
0.8,
"#7fbc41"
],
[
0.9,
"#4d9221"
],
[
1,
"#276419"
]
],
"sequential": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"sequentialminus": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
]
},
"colorway": [
"#636efa",
"#EF553B",
"#00cc96",
"#ab63fa",
"#FFA15A",
"#19d3f3",
"#FF6692",
"#B6E880",
"#FF97FF",
"#FECB52"
],
"font": {
"color": "#2a3f5f"
},
"geo": {
"bgcolor": "white",
"lakecolor": "white",
"landcolor": "white",
"showlakes": true,
"showland": true,
"subunitcolor": "#C8D4E3"
},
"hoverlabel": {
"align": "left"
},
"hovermode": "closest",
"mapbox": {
"style": "light"
},
"paper_bgcolor": "white",
"plot_bgcolor": "white",
"polar": {
"angularaxis": {
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": ""
},
"bgcolor": "white",
"radialaxis": {
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": ""
}
},
"scene": {
"xaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
},
"yaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
},
"zaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
}
},
"shapedefaults": {
"line": {
"color": "#2a3f5f"
}
},
"ternary": {
"aaxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
},
"baxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
},
"bgcolor": "white",
"caxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
}
},
"title": {
"x": 0.05
},
"xaxis": {
"automargin": true,
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "#EBF0F8",
"zerolinewidth": 2
},
"yaxis": {
"automargin": true,
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "#EBF0F8",
"zerolinewidth": 2
}
}
},
"title": {
"text": "Degree Distribution (log-log scale) of Foursquare Checkins Graph"
},
"width": 800,
"xaxis": {
"title": {
"text": "Degree"
},
"type": "log"
},
"yaxis": {
"title": {
"text": "Number of Nodes"
},
"type": "log"
}
}
},
"text/html": [
"<div> <div id=\"8b7f6fbe-9de9-44a1-9eb1-25eef8be3a15\" class=\"plotly-graph-div\" style=\"height:600px; width:800px;\"></div> <script type=\"text/javascript\"> require([\"plotly\"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById(\"8b7f6fbe-9de9-44a1-9eb1-25eef8be3a15\")) { Plotly.newPlot( \"8b7f6fbe-9de9-44a1-9eb1-25eef8be3a15\", [{\"name\":\"Degree Distribution\",\"x\":[33,498,158,143,321,376,203,349,286,329,479,710,76,422,289,600,271,793,469,110,333,1038,434,371,729,556,276,302,728,477,771,320,700,277,461,507,548,283,493,311,294,444,623,673,468,545,879,502,278,492,598,282,524,578,735,394,449,759,308,388,497,722,476,737,421,315,518,855,1061,313,335,392,620,454,280,828,406,432,381,383,856,544,327,696,512,564,312,346,674,792,796,521,474,443,466,370,712,859,368,340,970,395,606,316,854,345,689,336,781,279,553,360,378,486,653,331,420,314,902,829,299,632,403,355,292,484,570,281,920,409,325,412,431,428,347,440,773,318,941,705,823,485,552,363,362,652,319,875,451,483,359,944,310,585,684,339,334,495,642,893,305,562,467,780,622,789,560,456,288,455,487,337,442,536,969,373,344,768,482,567,624,803,917,475,905,857,1004,534,372,390,436,908,743,284,457,450,365,341,832,821,549,509,307,1,898,13,6,74,44,825,160,234,489,625,22,60,40,86,88,87,15,3,49,12,211,539,129,244,532,317,107,580,223,348,242,34,119,441,55,42,257,128,437,256,471,132,207,121,84,850,62,293,609,576,295,361,571,701,516,222,7,100,488,915,351,228,894,382,332,739,59,61,117,185,112,718,125,81,188,255,108,174,526,189,235,910,249,517,241,209,681,219,164,72,167,138,176,246,155,480,73,531,473,470,868,396,306,247,672,530,205,196,152,142,141,175,644,101,503,229,140,811,206,105,104,106,102,187,697,27,71,154,550,691,814,192,91,546,41,157,591,21,231,146,172,830,387,841,411,555,145,551,758,791,197,405,183,410,178,151,890,221,193,232,191,268,245,520,889,43,28,201,379,777,285,45,262,10,204,19,755,23,2,137,500,510,9,522,275,572,8,179,4,790,540,590,243,711,265,264,24,356,58,224,70,490,304,236,272,618,523,838,658,296,404,592,880,621,583,513,662,809,690,588,506,352,640,324,757,251,238,706,651,237,797,646,51,358,426,226,323,648,364,163,90,225,17,326,166,584,96,433,139,367,80,230,5,529,111,679,66,423,64,239,472,89,369,415,462,547,525,79,375,582,414,543,274,478,425,126,602,258,671,180,511,148,505,416,393,669,350,215,504,213,36,398,165,427,131,26,494,465,508,665,377,50,254,32,83,16,94,135,54,212,537,724,198,39,557,48,184,496,692,113,635,565,68,639,63,273,47,56,452,69,218,136,46,723,200,354,569,541,297,14,438,248,447,194,181,663,173,617,408,171,208,252,435,153,267,661,134,501,400,633,563,353,118,605,380,424,568,448,499,328,481,417,491,391,459,343,342,397,594,389,558,384,147,168,182,270,322,120,53,233,97,144,210,300,161,85,123,77,150,130,214,199,149,95,162,57,216,115,92,29,114,202,38,122,301,169,303,67,98,99,177,103,30,18,338,31,78,253,266,269,260,330,259,250,93,116,82,25,11,170,156,65,195,35,20,37,75,109,52],\"y\":[7,2,4,14,7,3,6,3,6,5,2,2,4,4,4,1,1,1,3,1,2,1,1,2,1,2,33,4,1,3,1,4,1,6,3,3,1,5,2,3,2,3,1,1,1,3,1,3,5,4,3,3,3,2,2,2,2,1,4,3,1,1,2,1,2,3,1,1,1,5,2,4,4,2,3,1,1,4,5,3,2,3,4,1,1,4,2,4,2,1,1,5,2,3,4,5,1,1,1,2,1,4,1,2,1,3,1,2,2,4,1,2,4,2,2,4,1,2,1,1,4,1,1,1,3,4,1,9,1,4,5,2,3,1,5,4,1,2,1,1,1,2,2,4,3,2,1,1,3,2,2,1,1,1,1,3,2,3,1,1,2,2,4,1,1,2,1,3,2,2,1,1,3,3,1,1,3,1,3,1,3,1,1,3,1,1,1,5,1,1,3,1,2,3,2,4,2,2,1,1,1,3,4,116,1,13,28,10,12,1,3,3,3,1,12,3,7,8,5,4,12,47,6,13,3,2,4,1,1,3,3,1,6,2,2,23,5,2,6,10,2,4,3,2,2,3,2,3,5,1,13,2,2,2,4,3,2,1,4,1,17,3,2,1,3,3,1,1,1,1,7,7,3,2,2,1,2,9,3,1,4,2,4,4,2,1,1,1,3,3,2,3,5,11,1,1,1,5,3,2,5,2,2,2,1,3,3,2,1,2,5,8,8,6,13,3,3,5,2,1,2,1,3,4,3,6,4,5,1,8,9,4,2,1,1,5,5,2,8,2,1,5,2,5,1,1,2,1,2,3,3,1,2,1,5,1,1,2,4,4,1,4,1,3,4,3,3,2,1,15,7,2,1,1,2,5,2,20,3,17,1,7,60,2,3,2,20,1,3,2,13,3,24,1,1,1,2,1,4,3,9,1,6,3,7,3,3,8,4,1,2,1,2,4,2,1,1,1,1,3,1,1,2,1,1,2,1,5,1,1,2,2,1,2,1,1,2,1,1,3,1,1,3,1,2,3,11,1,13,1,6,4,3,3,12,3,20,2,7,2,3,4,8,2,2,6,3,2,2,2,1,3,3,1,1,1,2,1,
" \n",
"var gd = document.getElementById('8b7f6fbe-9de9-44a1-9eb1-25eef8be3a15');\n",
"var x = new MutationObserver(function (mutations, observer) {{\n",
" var display = window.getComputedStyle(gd).display;\n",
" if (!display || display === 'none') {{\n",
" console.log([gd, 'removed!']);\n",
" Plotly.purge(gd);\n",
" observer.disconnect();\n",
" }}\n",
"}});\n",
"\n",
"// Listen for the removal of the full notebook cells\n",
"var notebookContainer = gd.closest('#notebook-container');\n",
"if (notebookContainer) {{\n",
" x.observe(notebookContainer, {childList: true});\n",
"}}\n",
"\n",
"// Listen for the clearing of the current output cell\n",
"var outputEl = gd.closest('.output');\n",
"if (outputEl) {{\n",
" x.observe(outputEl, {childList: true});\n",
"}}\n",
"\n",
" }) }; }); </script> </div>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"for G in checkins_graphs:\n",
" degree_distribution(G, log = True) # I suggest to use log = True, it is more readable"
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"name": "Degree Distribution",
"type": "bar",
"x": [
2,
2 years ago
3,
0,
12,
5,
2 years ago
8,
1,
2 years ago
4,
10,
15,
18,
9,
2 years ago
19,
6,
7,
17,
27,
13,
11,
23,
14,
21,
31
],
"y": [
162,
63,
664,
7,
29,
9,
455,
48,
9,
3,
2,
2 years ago
5,
2,
15,
11,
2 years ago
2,
1,
2 years ago
2,
4,
1,
4,
1,
1
]
}
],
"layout": {
"height": 600,
"template": {
"data": {
"bar": [
{
"error_x": {
"color": "#2a3f5f"
},
"error_y": {
"color": "#2a3f5f"
},
"marker": {
"line": {
"color": "white",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "bar"
}
],
"barpolar": [
{
"marker": {
"line": {
"color": "white",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "barpolar"
}
],
"carpet": [
{
"aaxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "#C8D4E3",
"linecolor": "#C8D4E3",
"minorgridcolor": "#C8D4E3",
"startlinecolor": "#2a3f5f"
},
"baxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "#C8D4E3",
"linecolor": "#C8D4E3",
"minorgridcolor": "#C8D4E3",
"startlinecolor": "#2a3f5f"
},
"type": "carpet"
}
],
"choropleth": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "choropleth"
}
],
"contour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "contour"
}
],
"contourcarpet": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "contourcarpet"
}
],
"heatmap": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmap"
}
],
"heatmapgl": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmapgl"
}
],
"histogram": [
{
"marker": {
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "histogram"
}
],
"histogram2d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2d"
}
],
"histogram2dcontour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2dcontour"
}
],
"mesh3d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "mesh3d"
}
],
"parcoords": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "parcoords"
}
],
"pie": [
{
"automargin": true,
"type": "pie"
}
],
"scatter": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter"
}
],
"scatter3d": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter3d"
}
],
"scattercarpet": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattercarpet"
}
],
"scattergeo": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergeo"
}
],
"scattergl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergl"
}
],
"scattermapbox": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattermapbox"
}
],
"scatterpolar": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolar"
}
],
"scatterpolargl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolargl"
}
],
"scatterternary": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterternary"
}
],
"surface": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "surface"
}
],
"table": [
{
"cells": {
"fill": {
"color": "#EBF0F8"
},
"line": {
"color": "white"
}
},
"header": {
"fill": {
"color": "#C8D4E3"
},
"line": {
"color": "white"
}
},
"type": "table"
}
]
},
"layout": {
"annotationdefaults": {
"arrowcolor": "#2a3f5f",
"arrowhead": 0,
"arrowwidth": 1
},
"autotypenumbers": "strict",
"coloraxis": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"colorscale": {
"diverging": [
[
0,
"#8e0152"
],
[
0.1,
"#c51b7d"
],
[
0.2,
"#de77ae"
],
[
0.3,
"#f1b6da"
],
[
0.4,
"#fde0ef"
],
[
0.5,
"#f7f7f7"
],
[
0.6,
"#e6f5d0"
],
[
0.7,
"#b8e186"
],
[
0.8,
"#7fbc41"
],
[
0.9,
"#4d9221"
],
[
1,
"#276419"
]
],
"sequential": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"sequentialminus": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
]
},
"colorway": [
"#636efa",
"#EF553B",
"#00cc96",
"#ab63fa",
"#FFA15A",
"#19d3f3",
"#FF6692",
"#B6E880",
"#FF97FF",
"#FECB52"
],
"font": {
"color": "#2a3f5f"
},
"geo": {
"bgcolor": "white",
"lakecolor": "white",
"landcolor": "white",
"showlakes": true,
"showland": true,
"subunitcolor": "#C8D4E3"
},
"hoverlabel": {
"align": "left"
},
"hovermode": "closest",
"mapbox": {
"style": "light"
},
"paper_bgcolor": "white",
"plot_bgcolor": "white",
"polar": {
"angularaxis": {
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": ""
},
"bgcolor": "white",
"radialaxis": {
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": ""
}
},
"scene": {
"xaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
},
"yaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
},
"zaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
}
},
"shapedefaults": {
"line": {
"color": "#2a3f5f"
}
},
"ternary": {
"aaxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
},
"baxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
},
"bgcolor": "white",
"caxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
}
},
"title": {
"x": 0.05
},
"xaxis": {
"automargin": true,
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "#EBF0F8",
"zerolinewidth": 2
},
"yaxis": {
"automargin": true,
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "#EBF0F8",
"zerolinewidth": 2
}
}
},
"title": {
"text": "Degree Distribution of Brightkite Friendship Graph"
},
"width": 800,
"xaxis": {
"title": {
"text": "Degree"
}
},
"yaxis": {
"title": {
"text": "Number of Nodes"
}
}
}
},
"text/html": [
"<div> <div id=\"5b756f6b-43d4-46e7-ae09-d9f60fae3138\" class=\"plotly-graph-div\" style=\"height:600px; width:800px;\"></div> <script type=\"text/javascript\"> require([\"plotly\"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById(\"5b756f6b-43d4-46e7-ae09-d9f60fae3138\")) { Plotly.newPlot( \"5b756f6b-43d4-46e7-ae09-d9f60fae3138\", [{\"name\":\"Degree Distribution\",\"x\":[2,3,0,12,5,8,1,4,10,15,18,9,19,6,7,17,27,13,11,23,14,21,31],\"y\":[162,63,664,7,29,9,455,48,9,3,2,5,2,15,11,2,1,2,4,1,4,1,1],\"type\":\"bar\"}], {\"template\":{\"data\":{\"barpolar\":[{\"marker\":{\"line\":{\"color\":\"white\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"barpolar\"}],\"bar\":[{\"error_x\":{\"color\":\"#2a3f5f\"},\"error_y\":{\"color\":\"#2a3f5f\"},\"marker\":{\"line\":{\"color\":\"white\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"bar\"}],\"carpet\":[{\"aaxis\":{\"endlinecolor\":\"#2a3f5f\",\"gridcolor\":\"#C8D4E3\",\"linecolor\":\"#C8D4E3\",\"minorgridcolor\":\"#C8D4E3\",\"startlinecolor\":\"#2a3f5f\"},\"baxis\":{\"endlinecolor\":\"#2a3f5f\",\"gridcolor\":\"#C8D4E3\",\"linecolor\":\"#C8D4E3\",\"minorgridcolor\":\"#C8D4E3\",\"startlinecolor\":\"#2a3f5f\"},\"type\":\"carpet\"}],\"choropleth\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"choropleth\"}],\"contourcarpet\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"contourcarpet\"}],\"contour\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"contour\"}],\"heatmapgl\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"heatmapgl\"}],\"heatmap\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"heatmap\"}],\"histogram2dcontour\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"histogram2dcontour\"}],\"histogram2d\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"histogram2d\"}],\"histogram\":[{\"marker\":{\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"histogram\"}],\"mesh3d\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"mesh3d\"}],\"parcoords\":[{\"line\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"parcoords\"}],\"pie\":[{\"automargin\"
" \n",
"var gd = document.getElementById('5b756f6b-43d4-46e7-ae09-d9f60fae3138');\n",
"var x = new MutationObserver(function (mutations, observer) {{\n",
" var display = window.getComputedStyle(gd).display;\n",
" if (!display || display === 'none') {{\n",
" console.log([gd, 'removed!']);\n",
" Plotly.purge(gd);\n",
" observer.disconnect();\n",
" }}\n",
"}});\n",
"\n",
"// Listen for the removal of the full notebook cells\n",
"var notebookContainer = gd.closest('#notebook-container');\n",
"if (notebookContainer) {{\n",
" x.observe(notebookContainer, {childList: true});\n",
"}}\n",
"\n",
"// Listen for the clearing of the current output cell\n",
"var outputEl = gd.closest('.output');\n",
"if (outputEl) {{\n",
" x.observe(outputEl, {childList: true});\n",
"}}\n",
"\n",
" }) }; }); </script> </div>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"name": "Degree Distribution",
"type": "bar",
"x": [
22,
25,
3,
2 years ago
32,
1,
21,
18,
10,
8,
12,
2 years ago
24,
13,
7,
2 years ago
6,
2,
9,
2 years ago
4,
36,
2 years ago
28,
5,
23,
20,
11,
14,
27,
31,
26,
29,
19,
15,
0,
34,
2 years ago
16,
35,
17
],
"y": [
2 years ago
3,
2,
174,
2 years ago
3,
486,
3,
2 years ago
7,
9,
19,
11,
2 years ago
3,
9,
35,
36,
255,
16,
91,
2 years ago
1,
1,
46,
2,
2,
13,
5,
2 years ago
2,
1,
3,
1,
3,
6,
241,
1,
5,
2,
3
]
}
],
"layout": {
"height": 600,
"template": {
"data": {
"bar": [
{
"error_x": {
"color": "#2a3f5f"
},
"error_y": {
"color": "#2a3f5f"
},
"marker": {
"line": {
"color": "white",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "bar"
}
],
"barpolar": [
{
"marker": {
"line": {
"color": "white",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "barpolar"
}
],
"carpet": [
{
"aaxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "#C8D4E3",
"linecolor": "#C8D4E3",
"minorgridcolor": "#C8D4E3",
"startlinecolor": "#2a3f5f"
},
"baxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "#C8D4E3",
"linecolor": "#C8D4E3",
"minorgridcolor": "#C8D4E3",
"startlinecolor": "#2a3f5f"
},
"type": "carpet"
}
],
"choropleth": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "choropleth"
}
],
"contour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "contour"
}
],
"contourcarpet": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "contourcarpet"
}
],
"heatmap": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmap"
}
],
"heatmapgl": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmapgl"
}
],
"histogram": [
{
"marker": {
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "histogram"
}
],
"histogram2d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2d"
}
],
"histogram2dcontour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2dcontour"
}
],
"mesh3d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "mesh3d"
}
],
"parcoords": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "parcoords"
}
],
"pie": [
{
"automargin": true,
"type": "pie"
}
],
"scatter": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter"
}
],
"scatter3d": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter3d"
}
],
"scattercarpet": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattercarpet"
}
],
"scattergeo": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergeo"
}
],
"scattergl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergl"
}
],
"scattermapbox": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattermapbox"
}
],
"scatterpolar": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolar"
}
],
"scatterpolargl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolargl"
}
],
"scatterternary": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterternary"
}
],
"surface": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "surface"
}
],
"table": [
{
"cells": {
"fill": {
"color": "#EBF0F8"
},
"line": {
"color": "white"
}
},
"header": {
"fill": {
"color": "#C8D4E3"
},
"line": {
"color": "white"
}
},
"type": "table"
}
]
},
"layout": {
"annotationdefaults": {
"arrowcolor": "#2a3f5f",
"arrowhead": 0,
"arrowwidth": 1
},
"autotypenumbers": "strict",
"coloraxis": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"colorscale": {
"diverging": [
[
0,
"#8e0152"
],
[
0.1,
"#c51b7d"
],
[
0.2,
"#de77ae"
],
[
0.3,
"#f1b6da"
],
[
0.4,
"#fde0ef"
],
[
0.5,
"#f7f7f7"
],
[
0.6,
"#e6f5d0"
],
[
0.7,
"#b8e186"
],
[
0.8,
"#7fbc41"
],
[
0.9,
"#4d9221"
],
[
1,
"#276419"
]
],
"sequential": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"sequentialminus": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
]
},
"colorway": [
"#636efa",
"#EF553B",
"#00cc96",
"#ab63fa",
"#FFA15A",
"#19d3f3",
"#FF6692",
"#B6E880",
"#FF97FF",
"#FECB52"
],
"font": {
"color": "#2a3f5f"
},
"geo": {
"bgcolor": "white",
"lakecolor": "white",
"landcolor": "white",
"showlakes": true,
"showland": true,
"subunitcolor": "#C8D4E3"
},
"hoverlabel": {
"align": "left"
},
"hovermode": "closest",
"mapbox": {
"style": "light"
},
"paper_bgcolor": "white",
"plot_bgcolor": "white",
"polar": {
"angularaxis": {
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": ""
},
"bgcolor": "white",
"radialaxis": {
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": ""
}
},
"scene": {
"xaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
},
"yaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
},
"zaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
}
},
"shapedefaults": {
"line": {
"color": "#2a3f5f"
}
},
"ternary": {
"aaxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
},
"baxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
},
"bgcolor": "white",
"caxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
}
},
"title": {
"x": 0.05
},
"xaxis": {
"automargin": true,
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "#EBF0F8",
"zerolinewidth": 2
},
"yaxis": {
"automargin": true,
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "#EBF0F8",
"zerolinewidth": 2
}
}
},
"title": {
"text": "Degree Distribution of Gowalla Friendship Graph"
},
"width": 800,
"xaxis": {
"title": {
"text": "Degree"
}
},
"yaxis": {
"title": {
"text": "Number of Nodes"
}
}
}
},
"text/html": [
"<div> <div id=\"b39bb068-c941-4b2d-9ba2-172124714a7e\" class=\"plotly-graph-div\" style=\"height:600px; width:800px;\"></div> <script type=\"text/javascript\"> require([\"plotly\"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById(\"b39bb068-c941-4b2d-9ba2-172124714a7e\")) { Plotly.newPlot( \"b39bb068-c941-4b2d-9ba2-172124714a7e\", [{\"name\":\"Degree Distribution\",\"x\":[22,25,3,32,1,21,18,10,8,12,24,13,7,6,2,9,4,36,28,5,23,20,11,14,27,31,26,29,19,15,0,34,16,35,17],\"y\":[3,2,174,3,486,3,7,9,19,11,3,9,35,36,255,16,91,1,1,46,2,2,13,5,2,1,3,1,3,6,241,1,5,2,3],\"type\":\"bar\"}], {\"template\":{\"data\":{\"barpolar\":[{\"marker\":{\"line\":{\"color\":\"white\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"barpolar\"}],\"bar\":[{\"error_x\":{\"color\":\"#2a3f5f\"},\"error_y\":{\"color\":\"#2a3f5f\"},\"marker\":{\"line\":{\"color\":\"white\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"bar\"}],\"carpet\":[{\"aaxis\":{\"endlinecolor\":\"#2a3f5f\",\"gridcolor\":\"#C8D4E3\",\"linecolor\":\"#C8D4E3\",\"minorgridcolor\":\"#C8D4E3\",\"startlinecolor\":\"#2a3f5f\"},\"baxis\":{\"endlinecolor\":\"#2a3f5f\",\"gridcolor\":\"#C8D4E3\",\"linecolor\":\"#C8D4E3\",\"minorgridcolor\":\"#C8D4E3\",\"startlinecolor\":\"#2a3f5f\"},\"type\":\"carpet\"}],\"choropleth\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"choropleth\"}],\"contourcarpet\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"contourcarpet\"}],\"contour\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"contour\"}],\"heatmapgl\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"heatmapgl\"}],\"heatmap\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"heatmap\"}],\"histogram2dcontour\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"histogram2dcontour\"}],\"histogram2d\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"histogram2d\"}],\"histogram\":[{\"marker\":{\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"histogram\"}],\"mesh3d\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"mesh3d\"}],\"parcoords\":[{\"line\":{\"colorbar\":{\"outlinewidth\":0,\
" \n",
"var gd = document.getElementById('b39bb068-c941-4b2d-9ba2-172124714a7e');\n",
"var x = new MutationObserver(function (mutations, observer) {{\n",
" var display = window.getComputedStyle(gd).display;\n",
" if (!display || display === 'none') {{\n",
" console.log([gd, 'removed!']);\n",
" Plotly.purge(gd);\n",
" observer.disconnect();\n",
" }}\n",
"}});\n",
"\n",
"// Listen for the removal of the full notebook cells\n",
"var notebookContainer = gd.closest('#notebook-container');\n",
"if (notebookContainer) {{\n",
" x.observe(notebookContainer, {childList: true});\n",
"}}\n",
"\n",
"// Listen for the clearing of the current output cell\n",
"var outputEl = gd.closest('.output');\n",
"if (outputEl) {{\n",
" x.observe(outputEl, {childList: true});\n",
"}}\n",
"\n",
" }) }; }); </script> </div>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"name": "Degree Distribution",
"type": "bar",
"x": [
10,
13,
9,
30,
14,
25,
45,
18,
56,
3,
8,
12,
37,
66,
1,
23,
36,
40,
4,
5,
6,
7,
33,
42,
15,
19,
27,
31,
49,
11,
63,
22,
24,
28,
46,
2,
32,
149,
58,
17,
54,
16,
48,
21,
20,
29,
59,
26,
38,
51,
44,
47,
43,
52,
39,
53,
34,
41,
73,
57,
35
],
"y": [
30,
19,
28,
2,
18,
11,
3,
8,
3,
130,
37,
17,
5,
1,
402,
12,
7,
2,
94,
69,
50,
43,
2,
3,
21,
8,
6,
5,
1,
24,
1,
8,
5,
8,
2,
217,
5,
1,
1,
15,
2,
10,
2,
6,
9,
8,
1,
7,
2,
1,
1,
1,
2,
1,
6,
1,
5,
4,
1,
1,
2
]
}
],
"layout": {
"height": 600,
"template": {
"data": {
"bar": [
{
"error_x": {
"color": "#2a3f5f"
},
"error_y": {
"color": "#2a3f5f"
},
"marker": {
"line": {
"color": "white",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "bar"
}
],
"barpolar": [
{
"marker": {
"line": {
"color": "white",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "barpolar"
}
],
"carpet": [
{
"aaxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "#C8D4E3",
"linecolor": "#C8D4E3",
"minorgridcolor": "#C8D4E3",
"startlinecolor": "#2a3f5f"
},
"baxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "#C8D4E3",
"linecolor": "#C8D4E3",
"minorgridcolor": "#C8D4E3",
"startlinecolor": "#2a3f5f"
},
"type": "carpet"
}
],
"choropleth": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "choropleth"
}
],
"contour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "contour"
}
],
"contourcarpet": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "contourcarpet"
}
],
"heatmap": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmap"
}
],
"heatmapgl": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmapgl"
}
],
"histogram": [
{
"marker": {
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "histogram"
}
],
"histogram2d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2d"
}
],
"histogram2dcontour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2dcontour"
}
],
"mesh3d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "mesh3d"
}
],
"parcoords": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "parcoords"
}
],
"pie": [
{
"automargin": true,
"type": "pie"
}
],
"scatter": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter"
}
],
"scatter3d": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter3d"
}
],
"scattercarpet": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattercarpet"
}
],
"scattergeo": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergeo"
}
],
"scattergl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergl"
}
],
"scattermapbox": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattermapbox"
}
],
"scatterpolar": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolar"
}
],
"scatterpolargl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolargl"
}
],
"scatterternary": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterternary"
}
],
"surface": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "surface"
}
],
"table": [
{
"cells": {
"fill": {
"color": "#EBF0F8"
},
"line": {
"color": "white"
}
},
"header": {
"fill": {
"color": "#C8D4E3"
},
"line": {
"color": "white"
}
},
"type": "table"
}
]
},
"layout": {
"annotationdefaults": {
"arrowcolor": "#2a3f5f",
"arrowhead": 0,
"arrowwidth": 1
},
"autotypenumbers": "strict",
"coloraxis": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"colorscale": {
"diverging": [
[
0,
"#8e0152"
],
[
0.1,
"#c51b7d"
],
[
0.2,
"#de77ae"
],
[
0.3,
"#f1b6da"
],
[
0.4,
"#fde0ef"
],
[
0.5,
"#f7f7f7"
],
[
0.6,
"#e6f5d0"
],
[
0.7,
"#b8e186"
],
[
0.8,
"#7fbc41"
],
[
0.9,
"#4d9221"
],
[
1,
"#276419"
]
],
"sequential": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"sequentialminus": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
]
},
"colorway": [
"#636efa",
"#EF553B",
"#00cc96",
"#ab63fa",
"#FFA15A",
"#19d3f3",
"#FF6692",
"#B6E880",
"#FF97FF",
"#FECB52"
],
"font": {
"color": "#2a3f5f"
},
"geo": {
"bgcolor": "white",
"lakecolor": "white",
"landcolor": "white",
"showlakes": true,
"showland": true,
"subunitcolor": "#C8D4E3"
},
"hoverlabel": {
"align": "left"
},
"hovermode": "closest",
"mapbox": {
"style": "light"
},
"paper_bgcolor": "white",
"plot_bgcolor": "white",
"polar": {
"angularaxis": {
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": ""
},
"bgcolor": "white",
"radialaxis": {
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": ""
}
},
"scene": {
"xaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
},
"yaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
},
"zaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
}
},
"shapedefaults": {
"line": {
"color": "#2a3f5f"
}
},
"ternary": {
"aaxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
},
"baxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
},
"bgcolor": "white",
"caxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
}
},
"title": {
"x": 0.05
},
"xaxis": {
"automargin": true,
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "#EBF0F8",
"zerolinewidth": 2
},
"yaxis": {
"automargin": true,
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "#EBF0F8",
"zerolinewidth": 2
}
}
},
"title": {
"text": "Degree Distribution of Foursquare Friendship Graph"
},
"width": 800,
"xaxis": {
"title": {
"text": "Degree"
}
},
"yaxis": {
"title": {
"text": "Number of Nodes"
}
}
}
},
"text/html": [
"<div> <div id=\"de668683-5252-467c-9605-bf2b4b76c200\" class=\"plotly-graph-div\" style=\"height:600px; width:800px;\"></div> <script type=\"text/javascript\"> require([\"plotly\"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById(\"de668683-5252-467c-9605-bf2b4b76c200\")) { Plotly.newPlot( \"de668683-5252-467c-9605-bf2b4b76c200\", [{\"name\":\"Degree Distribution\",\"x\":[10,13,9,30,14,25,45,18,56,3,8,12,37,66,1,23,36,40,4,5,6,7,33,42,15,19,27,31,49,11,63,22,24,28,46,2,32,149,58,17,54,16,48,21,20,29,59,26,38,51,44,47,43,52,39,53,34,41,73,57,35],\"y\":[30,19,28,2,18,11,3,8,3,130,37,17,5,1,402,12,7,2,94,69,50,43,2,3,21,8,6,5,1,24,1,8,5,8,2,217,5,1,1,15,2,10,2,6,9,8,1,7,2,1,1,1,2,1,6,1,5,4,1,1,2],\"type\":\"bar\"}], {\"template\":{\"data\":{\"barpolar\":[{\"marker\":{\"line\":{\"color\":\"white\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"barpolar\"}],\"bar\":[{\"error_x\":{\"color\":\"#2a3f5f\"},\"error_y\":{\"color\":\"#2a3f5f\"},\"marker\":{\"line\":{\"color\":\"white\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"bar\"}],\"carpet\":[{\"aaxis\":{\"endlinecolor\":\"#2a3f5f\",\"gridcolor\":\"#C8D4E3\",\"linecolor\":\"#C8D4E3\",\"minorgridcolor\":\"#C8D4E3\",\"startlinecolor\":\"#2a3f5f\"},\"baxis\":{\"endlinecolor\":\"#2a3f5f\",\"gridcolor\":\"#C8D4E3\",\"linecolor\":\"#C8D4E3\",\"minorgridcolor\":\"#C8D4E3\",\"startlinecolor\":\"#2a3f5f\"},\"type\":\"carpet\"}],\"choropleth\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"choropleth\"}],\"contourcarpet\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"contourcarpet\"}],\"contour\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"contour\"}],\"heatmapgl\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"heatmapgl\"}],\"heatmap\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"heatmap\"}],\"histogram2dcontour\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"histogram2dcontour\"}],\"histogram2d\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"histogram2d\"}],\"histogram\":[{\"marker\":{\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"histogram\"}],\"mesh
" \n",
"var gd = document.getElementById('de668683-5252-467c-9605-bf2b4b76c200');\n",
"var x = new MutationObserver(function (mutations, observer) {{\n",
" var display = window.getComputedStyle(gd).display;\n",
" if (!display || display === 'none') {{\n",
" console.log([gd, 'removed!']);\n",
" Plotly.purge(gd);\n",
" observer.disconnect();\n",
" }}\n",
"}});\n",
"\n",
"// Listen for the removal of the full notebook cells\n",
"var notebookContainer = gd.closest('#notebook-container');\n",
"if (notebookContainer) {{\n",
" x.observe(notebookContainer, {childList: true});\n",
"}}\n",
"\n",
"// Listen for the clearing of the current output cell\n",
"var outputEl = gd.closest('.output');\n",
"if (outputEl) {{\n",
" x.observe(outputEl, {childList: true});\n",
"}}\n",
"\n",
" }) }; }); </script> </div>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"for graph in friendships_graph:\n",
" degree_distribution(graph, log = False)"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
2 years ago
"From the graphs, we observe that the degree distribution of the networks is not Poissonian, but instead exhibits a scale-free pattern. This implies that the networks are not random, but rather exhibit the characteristics of small-world networks.\n",
"\n",
"For further investigation, we can plot the degree distribution of a random Watts-Strogatz graph, created with the same number of nodes and with a probability of edge formation equal to the number of edges in the network divided by the total number of possible edges. We expect to observe a Poissonian distribution in this case.\n",
"\n",
2 years ago
"> Note that this approach is only time-saving and not rigorous. For a rigorous analysis, we must follow the algorithm proposed by Maslov and Sneppen and implement it using the `random_reference` function in the NetworkX library."
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Brightkite Checkins Graph - Watts-Strogatz similarity\n",
"Number of nodes: 2324\n",
"Number of edges: 246344\n"
]
},
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"name": "Degree Distribution",
"type": "bar",
"x": [
216,
227,
215,
209,
214,
218,
2 years ago
200,
198,
2 years ago
197,
235,
192,
206,
219,
217,
205,
2 years ago
233,
222,
2 years ago
211,
212,
201,
193,
224,
2 years ago
213,
207,
234,
204,
208,
229,
228,
2 years ago
221,
203,
202,
2 years ago
220,
236,
199,
232,
223,
2 years ago
210,
230,
237,
2 years ago
190,
225,
196,
194,
226,
195,
189,
188,
191,
231,
2 years ago
241,
183,
238,
186,
240,
244
],
"y": [
86,
32,
92,
99,
2 years ago
95,
87,
35,
40,
37,
5,
12,
96,
67,
73,
76,
18,
54,
98,
88,
48,
20,
56,
79,
2 years ago
81,
7,
56,
93,
2 years ago
22,
30,
60,
67,
63,
64,
6,
36,
14,
41,
87,
23,
2,
10,
34,
28,
19,
27,
21,
6,
2 years ago
4,
7,
10,
2 years ago
2,
1,
5,
2 years ago
2,
2,
2 years ago
1
]
}
],
"layout": {
"height": 600,
"template": {
"data": {
"bar": [
{
"error_x": {
"color": "#2a3f5f"
},
"error_y": {
"color": "#2a3f5f"
},
"marker": {
"line": {
"color": "white",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "bar"
}
],
"barpolar": [
{
"marker": {
"line": {
"color": "white",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "barpolar"
}
],
"carpet": [
{
"aaxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "#C8D4E3",
"linecolor": "#C8D4E3",
"minorgridcolor": "#C8D4E3",
"startlinecolor": "#2a3f5f"
},
"baxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "#C8D4E3",
"linecolor": "#C8D4E3",
"minorgridcolor": "#C8D4E3",
"startlinecolor": "#2a3f5f"
},
"type": "carpet"
}
],
"choropleth": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "choropleth"
}
],
"contour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "contour"
}
],
"contourcarpet": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "contourcarpet"
}
],
"heatmap": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmap"
}
],
"heatmapgl": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmapgl"
}
],
"histogram": [
{
"marker": {
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "histogram"
}
],
"histogram2d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2d"
}
],
"histogram2dcontour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2dcontour"
}
],
"mesh3d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "mesh3d"
}
],
"parcoords": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "parcoords"
}
],
"pie": [
{
"automargin": true,
"type": "pie"
}
],
"scatter": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter"
}
],
"scatter3d": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter3d"
}
],
"scattercarpet": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattercarpet"
}
],
"scattergeo": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergeo"
}
],
"scattergl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergl"
}
],
"scattermapbox": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattermapbox"
}
],
"scatterpolar": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolar"
}
],
"scatterpolargl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolargl"
}
],
"scatterternary": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterternary"
}
],
"surface": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "surface"
}
],
"table": [
{
"cells": {
"fill": {
"color": "#EBF0F8"
},
"line": {
"color": "white"
}
},
"header": {
"fill": {
"color": "#C8D4E3"
},
"line": {
"color": "white"
}
},
"type": "table"
}
]
},
"layout": {
"annotationdefaults": {
"arrowcolor": "#2a3f5f",
"arrowhead": 0,
"arrowwidth": 1
},
"autotypenumbers": "strict",
"coloraxis": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"colorscale": {
"diverging": [
[
0,
"#8e0152"
],
[
0.1,
"#c51b7d"
],
[
0.2,
"#de77ae"
],
[
0.3,
"#f1b6da"
],
[
0.4,
"#fde0ef"
],
[
0.5,
"#f7f7f7"
],
[
0.6,
"#e6f5d0"
],
[
0.7,
"#b8e186"
],
[
0.8,
"#7fbc41"
],
[
0.9,
"#4d9221"
],
[
1,
"#276419"
]
],
"sequential": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"sequentialminus": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
]
},
"colorway": [
"#636efa",
"#EF553B",
"#00cc96",
"#ab63fa",
"#FFA15A",
"#19d3f3",
"#FF6692",
"#B6E880",
"#FF97FF",
"#FECB52"
],
"font": {
"color": "#2a3f5f"
},
"geo": {
"bgcolor": "white",
"lakecolor": "white",
"landcolor": "white",
"showlakes": true,
"showland": true,
"subunitcolor": "#C8D4E3"
},
"hoverlabel": {
"align": "left"
},
"hovermode": "closest",
"mapbox": {
"style": "light"
},
"paper_bgcolor": "white",
"plot_bgcolor": "white",
"polar": {
"angularaxis": {
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": ""
},
"bgcolor": "white",
"radialaxis": {
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": ""
}
},
"scene": {
"xaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
},
"yaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
},
"zaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
}
},
"shapedefaults": {
"line": {
"color": "#2a3f5f"
}
},
"ternary": {
"aaxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
},
"baxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
},
"bgcolor": "white",
"caxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
}
},
"title": {
"x": 0.05
},
"xaxis": {
"automargin": true,
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "#EBF0F8",
"zerolinewidth": 2
},
"yaxis": {
"automargin": true,
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "#EBF0F8",
"zerolinewidth": 2
}
}
},
"title": {
"text": "Degree Distribution of Brightkite Checkins Graph - Watts-Strogatz similarity"
},
"width": 800,
"xaxis": {
"title": {
"text": "Degree"
}
},
"yaxis": {
"title": {
"text": "Number of Nodes"
}
}
}
},
"text/html": [
"<div> <div id=\"6e0bc3eb-a045-4796-b9d0-bde3c1fd977a\" class=\"plotly-graph-div\" style=\"height:600px; width:800px;\"></div> <script type=\"text/javascript\"> require([\"plotly\"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById(\"6e0bc3eb-a045-4796-b9d0-bde3c1fd977a\")) { Plotly.newPlot( \"6e0bc3eb-a045-4796-b9d0-bde3c1fd977a\", [{\"name\":\"Degree Distribution\",\"x\":[216,227,215,209,214,218,200,198,197,235,192,206,219,217,205,233,222,211,212,201,193,224,213,207,234,204,208,229,228,221,203,202,220,236,199,232,223,210,230,237,190,225,196,194,226,195,189,188,191,231,241,183,238,186,240,244],\"y\":[86,32,92,99,95,87,35,40,37,5,12,96,67,73,76,18,54,98,88,48,20,56,79,81,7,56,93,22,30,60,67,63,64,6,36,14,41,87,23,2,10,34,28,19,27,21,6,4,7,10,2,1,5,2,2,1],\"type\":\"bar\"}], {\"template\":{\"data\":{\"barpolar\":[{\"marker\":{\"line\":{\"color\":\"white\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"barpolar\"}],\"bar\":[{\"error_x\":{\"color\":\"#2a3f5f\"},\"error_y\":{\"color\":\"#2a3f5f\"},\"marker\":{\"line\":{\"color\":\"white\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"bar\"}],\"carpet\":[{\"aaxis\":{\"endlinecolor\":\"#2a3f5f\",\"gridcolor\":\"#C8D4E3\",\"linecolor\":\"#C8D4E3\",\"minorgridcolor\":\"#C8D4E3\",\"startlinecolor\":\"#2a3f5f\"},\"baxis\":{\"endlinecolor\":\"#2a3f5f\",\"gridcolor\":\"#C8D4E3\",\"linecolor\":\"#C8D4E3\",\"minorgridcolor\":\"#C8D4E3\",\"startlinecolor\":\"#2a3f5f\"},\"type\":\"carpet\"}],\"choropleth\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"choropleth\"}],\"contourcarpet\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"contourcarpet\"}],\"contour\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"contour\"}],\"heatmapgl\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"heatmapgl\"}],\"heatmap\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"heatmap\"}],\"histogram2dcontour\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"histogram2dcontour\"}],\"histogram2d\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"histogram2d\"}],\"histogram\":[{\"marker\":{\"pattern\":{\"fillmode\":\"overlay\",\"
" \n",
"var gd = document.getElementById('6e0bc3eb-a045-4796-b9d0-bde3c1fd977a');\n",
"var x = new MutationObserver(function (mutations, observer) {{\n",
" var display = window.getComputedStyle(gd).display;\n",
" if (!display || display === 'none') {{\n",
" console.log([gd, 'removed!']);\n",
" Plotly.purge(gd);\n",
" observer.disconnect();\n",
" }}\n",
"}});\n",
"\n",
"// Listen for the removal of the full notebook cells\n",
"var notebookContainer = gd.closest('#notebook-container');\n",
"if (notebookContainer) {{\n",
" x.observe(notebookContainer, {childList: true});\n",
"}}\n",
"\n",
"// Listen for the clearing of the current output cell\n",
"var outputEl = gd.closest('.output');\n",
"if (outputEl) {{\n",
" x.observe(outputEl, {childList: true});\n",
"}}\n",
"\n",
" }) }; }); </script> </div>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Gowalla Checkins Graph - Watts-Strogatz similarity\n",
"Number of nodes: 2324\n",
"Number of edges: 246344\n"
]
},
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"name": "Degree Distribution",
"type": "bar",
"x": [
2 years ago
215,
214,
234,
200,
217,
2 years ago
223,
221,
224,
208,
229,
225,
211,
212,
2 years ago
203,
209,
2 years ago
206,
220,
213,
218,
216,
205,
231,
219,
201,
228,
237,
226,
2 years ago
191,
192,
199,
222,
2 years ago
233,
210,
232,
204,
202,
196,
207,
193,
195,
197,
227,
2 years ago
236,
180,
244,
198,
194,
189,
230,
181,
179,
2 years ago
190,
187,
235,
240,
2 years ago
185,
188,
186,
242,
238,
2 years ago
239,
184,
183,
241
],
"y": [
2 years ago
87,
85,
7,
44,
76,
2 years ago
47,
55,
42,
2 years ago
69,
20,
46,
96,
91,
52,
83,
88,
77,
88,
80,
97,
73,
21,
63,
54,
31,
6,
38,
11,
17,
36,
2 years ago
39,
16,
98,
18,
68,
55,
29,
83,
21,
25,
2 years ago
24,
29,
5,
1,
2,
41,
23,
5,
18,
1,
2 years ago
1,
4,
8,
9,
3,
3,
5,
2,
1,
2,
1,
2 years ago
2,
1,
1
]
}
],
"layout": {
"height": 600,
"template": {
"data": {
"bar": [
{
"error_x": {
"color": "#2a3f5f"
},
"error_y": {
"color": "#2a3f5f"
},
"marker": {
"line": {
"color": "white",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "bar"
}
],
"barpolar": [
{
"marker": {
"line": {
"color": "white",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "barpolar"
}
],
"carpet": [
{
"aaxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "#C8D4E3",
"linecolor": "#C8D4E3",
"minorgridcolor": "#C8D4E3",
"startlinecolor": "#2a3f5f"
},
"baxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "#C8D4E3",
"linecolor": "#C8D4E3",
"minorgridcolor": "#C8D4E3",
"startlinecolor": "#2a3f5f"
},
"type": "carpet"
}
],
"choropleth": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "choropleth"
}
],
"contour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "contour"
}
],
"contourcarpet": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "contourcarpet"
}
],
"heatmap": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmap"
}
],
"heatmapgl": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmapgl"
}
],
"histogram": [
{
"marker": {
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "histogram"
}
],
"histogram2d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2d"
}
],
"histogram2dcontour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2dcontour"
}
],
"mesh3d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "mesh3d"
}
],
"parcoords": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "parcoords"
}
],
"pie": [
{
"automargin": true,
"type": "pie"
}
],
"scatter": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter"
}
],
"scatter3d": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter3d"
}
],
"scattercarpet": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattercarpet"
}
],
"scattergeo": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergeo"
}
],
"scattergl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergl"
}
],
"scattermapbox": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattermapbox"
}
],
"scatterpolar": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolar"
}
],
"scatterpolargl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolargl"
}
],
"scatterternary": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterternary"
}
],
"surface": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "surface"
}
],
"table": [
{
"cells": {
"fill": {
"color": "#EBF0F8"
},
"line": {
"color": "white"
}
},
"header": {
"fill": {
"color": "#C8D4E3"
},
"line": {
"color": "white"
}
},
"type": "table"
}
]
},
"layout": {
"annotationdefaults": {
"arrowcolor": "#2a3f5f",
"arrowhead": 0,
"arrowwidth": 1
},
"autotypenumbers": "strict",
"coloraxis": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"colorscale": {
"diverging": [
[
0,
"#8e0152"
],
[
0.1,
"#c51b7d"
],
[
0.2,
"#de77ae"
],
[
0.3,
"#f1b6da"
],
[
0.4,
"#fde0ef"
],
[
0.5,
"#f7f7f7"
],
[
0.6,
"#e6f5d0"
],
[
0.7,
"#b8e186"
],
[
0.8,
"#7fbc41"
],
[
0.9,
"#4d9221"
],
[
1,
"#276419"
]
],
"sequential": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"sequentialminus": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
]
},
"colorway": [
"#636efa",
"#EF553B",
"#00cc96",
"#ab63fa",
"#FFA15A",
"#19d3f3",
"#FF6692",
"#B6E880",
"#FF97FF",
"#FECB52"
],
"font": {
"color": "#2a3f5f"
},
"geo": {
"bgcolor": "white",
"lakecolor": "white",
"landcolor": "white",
"showlakes": true,
"showland": true,
"subunitcolor": "#C8D4E3"
},
"hoverlabel": {
"align": "left"
},
"hovermode": "closest",
"mapbox": {
"style": "light"
},
"paper_bgcolor": "white",
"plot_bgcolor": "white",
"polar": {
"angularaxis": {
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": ""
},
"bgcolor": "white",
"radialaxis": {
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": ""
}
},
"scene": {
"xaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
},
"yaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
},
"zaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
}
},
"shapedefaults": {
"line": {
"color": "#2a3f5f"
}
},
"ternary": {
"aaxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
},
"baxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
},
"bgcolor": "white",
"caxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
}
},
"title": {
"x": 0.05
},
"xaxis": {
"automargin": true,
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "#EBF0F8",
"zerolinewidth": 2
},
"yaxis": {
"automargin": true,
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "#EBF0F8",
"zerolinewidth": 2
}
}
},
"title": {
"text": "Degree Distribution of Gowalla Checkins Graph - Watts-Strogatz similarity"
},
"width": 800,
"xaxis": {
"title": {
"text": "Degree"
}
},
"yaxis": {
"title": {
"text": "Number of Nodes"
}
}
}
},
"text/html": [
"<div> <div id=\"50f5dbd7-2534-4341-a97a-c608d9540ee1\" class=\"plotly-graph-div\" style=\"height:600px; width:800px;\"></div> <script type=\"text/javascript\"> require([\"plotly\"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById(\"50f5dbd7-2534-4341-a97a-c608d9540ee1\")) { Plotly.newPlot( \"50f5dbd7-2534-4341-a97a-c608d9540ee1\", [{\"name\":\"Degree Distribution\",\"x\":[215,214,234,200,217,223,221,224,208,229,225,211,212,203,209,206,220,213,218,216,205,231,219,201,228,237,226,191,192,199,222,233,210,232,204,202,196,207,193,195,197,227,236,180,244,198,194,189,230,181,179,190,187,235,240,185,188,186,242,238,239,184,183,241],\"y\":[87,85,7,44,76,47,55,42,69,20,46,96,91,52,83,88,77,88,80,97,73,21,63,54,31,6,38,11,17,36,39,16,98,18,68,55,29,83,21,25,24,29,5,1,2,41,23,5,18,1,1,4,8,9,3,3,5,2,1,2,1,2,1,1],\"type\":\"bar\"}], {\"template\":{\"data\":{\"barpolar\":[{\"marker\":{\"line\":{\"color\":\"white\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"barpolar\"}],\"bar\":[{\"error_x\":{\"color\":\"#2a3f5f\"},\"error_y\":{\"color\":\"#2a3f5f\"},\"marker\":{\"line\":{\"color\":\"white\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"bar\"}],\"carpet\":[{\"aaxis\":{\"endlinecolor\":\"#2a3f5f\",\"gridcolor\":\"#C8D4E3\",\"linecolor\":\"#C8D4E3\",\"minorgridcolor\":\"#C8D4E3\",\"startlinecolor\":\"#2a3f5f\"},\"baxis\":{\"endlinecolor\":\"#2a3f5f\",\"gridcolor\":\"#C8D4E3\",\"linecolor\":\"#C8D4E3\",\"minorgridcolor\":\"#C8D4E3\",\"startlinecolor\":\"#2a3f5f\"},\"type\":\"carpet\"}],\"choropleth\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"choropleth\"}],\"contourcarpet\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"contourcarpet\"}],\"contour\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"contour\"}],\"heatmapgl\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"heatmapgl\"}],\"heatmap\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"heatmap\"}],\"histogram2dcontour\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"histogram2dcontour\"}],\"histogram2d\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"histogram2d\"}],\"histogram\":[{\"ma
" \n",
"var gd = document.getElementById('50f5dbd7-2534-4341-a97a-c608d9540ee1');\n",
"var x = new MutationObserver(function (mutations, observer) {{\n",
" var display = window.getComputedStyle(gd).display;\n",
" if (!display || display === 'none') {{\n",
" console.log([gd, 'removed!']);\n",
" Plotly.purge(gd);\n",
" observer.disconnect();\n",
" }}\n",
"}});\n",
"\n",
"// Listen for the removal of the full notebook cells\n",
"var notebookContainer = gd.closest('#notebook-container');\n",
"if (notebookContainer) {{\n",
" x.observe(notebookContainer, {childList: true});\n",
"}}\n",
"\n",
"// Listen for the clearing of the current output cell\n",
"var outputEl = gd.closest('.output');\n",
"if (outputEl) {{\n",
" x.observe(outputEl, {childList: true});\n",
"}}\n",
"\n",
" }) }; }); </script> </div>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Foursquare Checkins Graph - Watts-Strogatz similarity\n",
"Number of nodes: 2324\n",
"Number of edges: 246344\n"
]
},
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"name": "Degree Distribution",
"type": "bar",
"x": [
220,
213,
204,
198,
207,
2 years ago
201,
217,
212,
192,
216,
2 years ago
223,
229,
202,
215,
243,
209,
211,
221,
219,
227,
218,
224,
222,
203,
200,
205,
193,
208,
214,
210,
2 years ago
230,
231,
188,
2 years ago
195,
197,
226,
206,
196,
228,
191,
2 years ago
232,
199,
194,
237,
182,
236,
225,
2 years ago
190,
189,
235,
248,
186,
234,
187,
2 years ago
238,
233,
239,
240,
242,
179,
184,
244,
180,
241,
183
],
"y": [
63,
91,
70,
27,
84,
53,
77,
92,
11,
88,
46,
17,
59,
80,
2,
93,
95,
73,
70,
34,
2 years ago
76,
61,
39,
59,
58,
75,
18,
2 years ago
78,
93,
79,
19,
21,
6,
30,
26,
2 years ago
42,
69,
30,
16,
12,
19,
32,
22,
2 years ago
1,
3,
9,
44,
2 years ago
12,
7,
2 years ago
3,
1,
2,
7,
2,
3,
2 years ago
11,
1,
2 years ago
3,
3,
1,
2,
1,
1,
1,
1
]
}
],
"layout": {
"height": 600,
"template": {
"data": {
"bar": [
{
"error_x": {
"color": "#2a3f5f"
},
"error_y": {
"color": "#2a3f5f"
},
"marker": {
"line": {
"color": "white",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "bar"
}
],
"barpolar": [
{
"marker": {
"line": {
"color": "white",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "barpolar"
}
],
"carpet": [
{
"aaxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "#C8D4E3",
"linecolor": "#C8D4E3",
"minorgridcolor": "#C8D4E3",
"startlinecolor": "#2a3f5f"
},
"baxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "#C8D4E3",
"linecolor": "#C8D4E3",
"minorgridcolor": "#C8D4E3",
"startlinecolor": "#2a3f5f"
},
"type": "carpet"
}
],
"choropleth": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "choropleth"
}
],
"contour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "contour"
}
],
"contourcarpet": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "contourcarpet"
}
],
"heatmap": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmap"
}
],
"heatmapgl": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmapgl"
}
],
"histogram": [
{
"marker": {
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "histogram"
}
],
"histogram2d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2d"
}
],
"histogram2dcontour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2dcontour"
}
],
"mesh3d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "mesh3d"
}
],
"parcoords": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "parcoords"
}
],
"pie": [
{
"automargin": true,
"type": "pie"
}
],
"scatter": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter"
}
],
"scatter3d": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter3d"
}
],
"scattercarpet": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattercarpet"
}
],
"scattergeo": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergeo"
}
],
"scattergl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergl"
}
],
"scattermapbox": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattermapbox"
}
],
"scatterpolar": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolar"
}
],
"scatterpolargl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolargl"
}
],
"scatterternary": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterternary"
}
],
"surface": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "surface"
}
],
"table": [
{
"cells": {
"fill": {
"color": "#EBF0F8"
},
"line": {
"color": "white"
}
},
"header": {
"fill": {
"color": "#C8D4E3"
},
"line": {
"color": "white"
}
},
"type": "table"
}
]
},
"layout": {
"annotationdefaults": {
"arrowcolor": "#2a3f5f",
"arrowhead": 0,
"arrowwidth": 1
},
"autotypenumbers": "strict",
"coloraxis": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"colorscale": {
"diverging": [
[
0,
"#8e0152"
],
[
0.1,
"#c51b7d"
],
[
0.2,
"#de77ae"
],
[
0.3,
"#f1b6da"
],
[
0.4,
"#fde0ef"
],
[
0.5,
"#f7f7f7"
],
[
0.6,
"#e6f5d0"
],
[
0.7,
"#b8e186"
],
[
0.8,
"#7fbc41"
],
[
0.9,
"#4d9221"
],
[
1,
"#276419"
]
],
"sequential": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"sequentialminus": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
]
},
"colorway": [
"#636efa",
"#EF553B",
"#00cc96",
"#ab63fa",
"#FFA15A",
"#19d3f3",
"#FF6692",
"#B6E880",
"#FF97FF",
"#FECB52"
],
"font": {
"color": "#2a3f5f"
},
"geo": {
"bgcolor": "white",
"lakecolor": "white",
"landcolor": "white",
"showlakes": true,
"showland": true,
"subunitcolor": "#C8D4E3"
},
"hoverlabel": {
"align": "left"
},
"hovermode": "closest",
"mapbox": {
"style": "light"
},
"paper_bgcolor": "white",
"plot_bgcolor": "white",
"polar": {
"angularaxis": {
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": ""
},
"bgcolor": "white",
"radialaxis": {
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": ""
}
},
"scene": {
"xaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
},
"yaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
},
"zaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
}
},
"shapedefaults": {
"line": {
"color": "#2a3f5f"
}
},
"ternary": {
"aaxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
},
"baxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
},
"bgcolor": "white",
"caxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
}
},
"title": {
"x": 0.05
},
"xaxis": {
"automargin": true,
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "#EBF0F8",
"zerolinewidth": 2
},
"yaxis": {
"automargin": true,
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "#EBF0F8",
"zerolinewidth": 2
}
}
},
"title": {
"text": "Degree Distribution of Foursquare Checkins Graph - Watts-Strogatz similarity"
},
"width": 800,
"xaxis": {
"title": {
"text": "Degree"
}
},
"yaxis": {
"title": {
"text": "Number of Nodes"
}
}
}
},
"text/html": [
"<div> <div id=\"ea3a5deb-48d6-41f0-b56b-39baebce627a\" class=\"plotly-graph-div\" style=\"height:600px; width:800px;\"></div> <script type=\"text/javascript\"> require([\"plotly\"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById(\"ea3a5deb-48d6-41f0-b56b-39baebce627a\")) { Plotly.newPlot( \"ea3a5deb-48d6-41f0-b56b-39baebce627a\", [{\"name\":\"Degree Distribution\",\"x\":[220,213,204,198,207,201,217,212,192,216,223,229,202,215,243,209,211,221,219,227,218,224,222,203,200,205,193,208,214,210,230,231,188,195,197,226,206,196,228,191,232,199,194,237,182,236,225,190,189,235,248,186,234,187,238,233,239,240,242,179,184,244,180,241,183],\"y\":[63,91,70,27,84,53,77,92,11,88,46,17,59,80,2,93,95,73,70,34,76,61,39,59,58,75,18,78,93,79,19,21,6,30,26,42,69,30,16,12,19,32,22,1,3,9,44,12,7,3,1,2,7,2,3,11,1,3,3,1,2,1,1,1,1],\"type\":\"bar\"}], {\"template\":{\"data\":{\"barpolar\":[{\"marker\":{\"line\":{\"color\":\"white\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"barpolar\"}],\"bar\":[{\"error_x\":{\"color\":\"#2a3f5f\"},\"error_y\":{\"color\":\"#2a3f5f\"},\"marker\":{\"line\":{\"color\":\"white\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"bar\"}],\"carpet\":[{\"aaxis\":{\"endlinecolor\":\"#2a3f5f\",\"gridcolor\":\"#C8D4E3\",\"linecolor\":\"#C8D4E3\",\"minorgridcolor\":\"#C8D4E3\",\"startlinecolor\":\"#2a3f5f\"},\"baxis\":{\"endlinecolor\":\"#2a3f5f\",\"gridcolor\":\"#C8D4E3\",\"linecolor\":\"#C8D4E3\",\"minorgridcolor\":\"#C8D4E3\",\"startlinecolor\":\"#2a3f5f\"},\"type\":\"carpet\"}],\"choropleth\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"choropleth\"}],\"contourcarpet\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"contourcarpet\"}],\"contour\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"contour\"}],\"heatmapgl\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"heatmapgl\"}],\"heatmap\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"heatmap\"}],\"histogram2dcontour\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"histogram2dcontour\"}],\"histogram2d\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"histogram2d\"}],\"histogram\"
" \n",
"var gd = document.getElementById('ea3a5deb-48d6-41f0-b56b-39baebce627a');\n",
"var x = new MutationObserver(function (mutations, observer) {{\n",
" var display = window.getComputedStyle(gd).display;\n",
" if (!display || display === 'none') {{\n",
" console.log([gd, 'removed!']);\n",
" Plotly.purge(gd);\n",
" observer.disconnect();\n",
" }}\n",
"}});\n",
"\n",
"// Listen for the removal of the full notebook cells\n",
"var notebookContainer = gd.closest('#notebook-container');\n",
"if (notebookContainer) {{\n",
" x.observe(notebookContainer, {childList: true});\n",
"}}\n",
"\n",
"// Listen for the clearing of the current output cell\n",
"var outputEl = gd.closest('.output');\n",
"if (outputEl) {{\n",
" x.observe(outputEl, {childList: true});\n",
"}}\n",
"\n",
" }) }; }); </script> </div>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"for graph in checkins_graphs:\n",
"\n",
" p = G.number_of_edges() / (G.number_of_nodes())\n",
" avg_degree = int(np.mean([d for n, d in G.degree()]))\n",
" G = nx.watts_strogatz_graph(G.number_of_nodes(), avg_degree, p)\n",
" G.name = graph.name + \" - Watts-Strogatz similarity\"\n",
"\n",
" print(G.name)\n",
" print(\"Number of nodes: \", G.number_of_nodes())\n",
" print(\"Number of edges: \", G.number_of_edges())\n",
" degree_distribution(G, log=False)\n",
" "
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Brightkite Friendship Graph - Watts-Strogatz similarity\n",
"Number of nodes: 2324\n",
"Number of edges: 246344\n"
]
},
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"name": "Degree Distribution",
"type": "bar",
"x": [
218,
217,
194,
2 years ago
207,
214,
2 years ago
211,
216,
215,
229,
2 years ago
220,
202,
221,
201,
2 years ago
213,
225,
235,
223,
2 years ago
205,
219,
212,
208,
206,
2 years ago
227,
198,
199,
193,
200,
210,
228,
224,
204,
186,
230,
2 years ago
196,
185,
197,
2 years ago
226,
233,
203,
195,
237,
236,
209,
190,
187,
192,
222,
232,
240,
191,
231,
188,
238,
241,
234,
242,
189,
180,
243,
245,
239,
182,
184,
252
],
"y": [
82,
85,
16,
89,
106,
76,
63,
83,
24,
85,
48,
71,
54,
2 years ago
94,
37,
8,
49,
73,
72,
91,
103,
87,
28,
44,
39,
23,
45,
92,
21,
36,
78,
1,
20,
2 years ago
18,
1,
31,
38,
9,
69,
22,
3,
8,
67,
8,
2 years ago
4,
9,
36,
16,
3,
11,
19,
4,
2,
2,
2 years ago
5,
2,
2 years ago
5,
2,
1,
1,
2,
1,
1,
1
]
}
],
"layout": {
"height": 600,
"template": {
"data": {
"bar": [
{
"error_x": {
"color": "#2a3f5f"
},
"error_y": {
"color": "#2a3f5f"
},
"marker": {
"line": {
"color": "white",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "bar"
}
],
"barpolar": [
{
"marker": {
"line": {
"color": "white",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "barpolar"
}
],
"carpet": [
{
"aaxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "#C8D4E3",
"linecolor": "#C8D4E3",
"minorgridcolor": "#C8D4E3",
"startlinecolor": "#2a3f5f"
},
"baxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "#C8D4E3",
"linecolor": "#C8D4E3",
"minorgridcolor": "#C8D4E3",
"startlinecolor": "#2a3f5f"
},
"type": "carpet"
}
],
"choropleth": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "choropleth"
}
],
"contour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "contour"
}
],
"contourcarpet": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "contourcarpet"
}
],
"heatmap": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmap"
}
],
"heatmapgl": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmapgl"
}
],
"histogram": [
{
"marker": {
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "histogram"
}
],
"histogram2d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2d"
}
],
"histogram2dcontour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2dcontour"
}
],
"mesh3d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "mesh3d"
}
],
"parcoords": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "parcoords"
}
],
"pie": [
{
"automargin": true,
"type": "pie"
}
],
"scatter": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter"
}
],
"scatter3d": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter3d"
}
],
"scattercarpet": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattercarpet"
}
],
"scattergeo": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergeo"
}
],
"scattergl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergl"
}
],
"scattermapbox": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattermapbox"
}
],
"scatterpolar": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolar"
}
],
"scatterpolargl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolargl"
}
],
"scatterternary": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterternary"
}
],
"surface": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "surface"
}
],
"table": [
{
"cells": {
"fill": {
"color": "#EBF0F8"
},
"line": {
"color": "white"
}
},
"header": {
"fill": {
"color": "#C8D4E3"
},
"line": {
"color": "white"
}
},
"type": "table"
}
]
},
"layout": {
"annotationdefaults": {
"arrowcolor": "#2a3f5f",
"arrowhead": 0,
"arrowwidth": 1
},
"autotypenumbers": "strict",
"coloraxis": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"colorscale": {
"diverging": [
[
0,
"#8e0152"
],
[
0.1,
"#c51b7d"
],
[
0.2,
"#de77ae"
],
[
0.3,
"#f1b6da"
],
[
0.4,
"#fde0ef"
],
[
0.5,
"#f7f7f7"
],
[
0.6,
"#e6f5d0"
],
[
0.7,
"#b8e186"
],
[
0.8,
"#7fbc41"
],
[
0.9,
"#4d9221"
],
[
1,
"#276419"
]
],
"sequential": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"sequentialminus": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
]
},
"colorway": [
"#636efa",
"#EF553B",
"#00cc96",
"#ab63fa",
"#FFA15A",
"#19d3f3",
"#FF6692",
"#B6E880",
"#FF97FF",
"#FECB52"
],
"font": {
"color": "#2a3f5f"
},
"geo": {
"bgcolor": "white",
"lakecolor": "white",
"landcolor": "white",
"showlakes": true,
"showland": true,
"subunitcolor": "#C8D4E3"
},
"hoverlabel": {
"align": "left"
},
"hovermode": "closest",
"mapbox": {
"style": "light"
},
"paper_bgcolor": "white",
"plot_bgcolor": "white",
"polar": {
"angularaxis": {
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": ""
},
"bgcolor": "white",
"radialaxis": {
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": ""
}
},
"scene": {
"xaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
},
"yaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
},
"zaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
}
},
"shapedefaults": {
"line": {
"color": "#2a3f5f"
}
},
"ternary": {
"aaxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
},
"baxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
},
"bgcolor": "white",
"caxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
}
},
"title": {
"x": 0.05
},
"xaxis": {
"automargin": true,
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "#EBF0F8",
"zerolinewidth": 2
},
"yaxis": {
"automargin": true,
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "#EBF0F8",
"zerolinewidth": 2
}
}
},
"title": {
"text": "Degree Distribution of Brightkite Friendship Graph - Watts-Strogatz similarity"
},
"width": 800,
"xaxis": {
"title": {
"text": "Degree"
}
},
"yaxis": {
"title": {
"text": "Number of Nodes"
}
}
}
},
"text/html": [
"<div> <div id=\"50f01dc1-2029-49b8-862f-6c8d54a3d0fa\" class=\"plotly-graph-div\" style=\"height:600px; width:800px;\"></div> <script type=\"text/javascript\"> require([\"plotly\"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById(\"50f01dc1-2029-49b8-862f-6c8d54a3d0fa\")) { Plotly.newPlot( \"50f01dc1-2029-49b8-862f-6c8d54a3d0fa\", [{\"name\":\"Degree Distribution\",\"x\":[218,217,194,207,214,211,216,215,229,220,202,221,201,213,225,235,223,205,219,212,208,206,227,198,199,193,200,210,228,224,204,186,230,196,185,197,226,233,203,195,237,236,209,190,187,192,222,232,240,191,231,188,238,241,234,242,189,180,243,245,239,182,184,252],\"y\":[82,85,16,89,106,76,63,83,24,85,48,71,54,94,37,8,49,73,72,91,103,87,28,44,39,23,45,92,21,36,78,1,20,18,1,31,38,9,69,22,3,8,67,8,4,9,36,16,3,11,19,4,2,2,5,2,5,2,1,1,2,1,1,1],\"type\":\"bar\"}], {\"template\":{\"data\":{\"barpolar\":[{\"marker\":{\"line\":{\"color\":\"white\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"barpolar\"}],\"bar\":[{\"error_x\":{\"color\":\"#2a3f5f\"},\"error_y\":{\"color\":\"#2a3f5f\"},\"marker\":{\"line\":{\"color\":\"white\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"bar\"}],\"carpet\":[{\"aaxis\":{\"endlinecolor\":\"#2a3f5f\",\"gridcolor\":\"#C8D4E3\",\"linecolor\":\"#C8D4E3\",\"minorgridcolor\":\"#C8D4E3\",\"startlinecolor\":\"#2a3f5f\"},\"baxis\":{\"endlinecolor\":\"#2a3f5f\",\"gridcolor\":\"#C8D4E3\",\"linecolor\":\"#C8D4E3\",\"minorgridcolor\":\"#C8D4E3\",\"startlinecolor\":\"#2a3f5f\"},\"type\":\"carpet\"}],\"choropleth\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"choropleth\"}],\"contourcarpet\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"contourcarpet\"}],\"contour\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"contour\"}],\"heatmapgl\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"heatmapgl\"}],\"heatmap\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"heatmap\"}],\"histogram2dcontour\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"histogram2dcontour\"}],\"histogram2d\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"histogram2d\"}],\"histogram\":[{\"ma
" \n",
"var gd = document.getElementById('50f01dc1-2029-49b8-862f-6c8d54a3d0fa');\n",
"var x = new MutationObserver(function (mutations, observer) {{\n",
" var display = window.getComputedStyle(gd).display;\n",
" if (!display || display === 'none') {{\n",
" console.log([gd, 'removed!']);\n",
" Plotly.purge(gd);\n",
" observer.disconnect();\n",
" }}\n",
"}});\n",
"\n",
"// Listen for the removal of the full notebook cells\n",
"var notebookContainer = gd.closest('#notebook-container');\n",
"if (notebookContainer) {{\n",
" x.observe(notebookContainer, {childList: true});\n",
"}}\n",
"\n",
"// Listen for the clearing of the current output cell\n",
"var outputEl = gd.closest('.output');\n",
"if (outputEl) {{\n",
" x.observe(outputEl, {childList: true});\n",
"}}\n",
"\n",
" }) }; }); </script> </div>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Gowalla Friendship Graph - Watts-Strogatz similarity\n",
"Number of nodes: 2324\n",
"Number of edges: 246344\n"
]
},
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"name": "Degree Distribution",
"type": "bar",
"x": [
200,
191,
203,
204,
206,
216,
220,
212,
2 years ago
209,
201,
2 years ago
213,
207,
221,
2 years ago
211,
214,
198,
236,
202,
2 years ago
217,
210,
190,
2 years ago
219,
222,
218,
226,
195,
215,
225,
208,
205,
224,
192,
232,
227,
197,
228,
194,
188,
199,
243,
237,
2 years ago
223,
229,
2 years ago
234,
189,
230,
2 years ago
196,
247,
231,
2 years ago
241,
184,
248,
2 years ago
242,
186,
235,
193,
233,
2 years ago
185,
172,
240,
238,
180,
239,
187,
181,
182
],
"y": [
58,
13,
62,
58,
85,
82,
67,
93,
90,
2 years ago
50,
98,
2 years ago
86,
61,
81,
98,
37,
7,
49,
105,
83,
7,
67,
2 years ago
53,
78,
37,
2 years ago
30,
94,
40,
85,
72,
38,
11,
12,
2 years ago
23,
38,
29,
2 years ago
12,
1,
39,
1,
3,
52,
20,
5,
7,
2 years ago
18,
29,
1,
16,
3,
1,
1,
1,
1,
3,
6,
13,
3,
1,
2 years ago
3,
1,
2,
1,
1,
1,
1
]
}
],
"layout": {
"height": 600,
"template": {
"data": {
"bar": [
{
"error_x": {
"color": "#2a3f5f"
},
"error_y": {
"color": "#2a3f5f"
},
"marker": {
"line": {
"color": "white",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "bar"
}
],
"barpolar": [
{
"marker": {
"line": {
"color": "white",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "barpolar"
}
],
"carpet": [
{
"aaxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "#C8D4E3",
"linecolor": "#C8D4E3",
"minorgridcolor": "#C8D4E3",
"startlinecolor": "#2a3f5f"
},
"baxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "#C8D4E3",
"linecolor": "#C8D4E3",
"minorgridcolor": "#C8D4E3",
"startlinecolor": "#2a3f5f"
},
"type": "carpet"
}
],
"choropleth": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "choropleth"
}
],
"contour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "contour"
}
],
"contourcarpet": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "contourcarpet"
}
],
"heatmap": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmap"
}
],
"heatmapgl": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmapgl"
}
],
"histogram": [
{
"marker": {
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "histogram"
}
],
"histogram2d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2d"
}
],
"histogram2dcontour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2dcontour"
}
],
"mesh3d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "mesh3d"
}
],
"parcoords": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "parcoords"
}
],
"pie": [
{
"automargin": true,
"type": "pie"
}
],
"scatter": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter"
}
],
"scatter3d": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter3d"
}
],
"scattercarpet": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattercarpet"
}
],
"scattergeo": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergeo"
}
],
"scattergl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergl"
}
],
"scattermapbox": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattermapbox"
}
],
"scatterpolar": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolar"
}
],
"scatterpolargl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolargl"
}
],
"scatterternary": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterternary"
}
],
"surface": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "surface"
}
],
"table": [
{
"cells": {
"fill": {
"color": "#EBF0F8"
},
"line": {
"color": "white"
}
},
"header": {
"fill": {
"color": "#C8D4E3"
},
"line": {
"color": "white"
}
},
"type": "table"
}
]
},
"layout": {
"annotationdefaults": {
"arrowcolor": "#2a3f5f",
"arrowhead": 0,
"arrowwidth": 1
},
"autotypenumbers": "strict",
"coloraxis": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"colorscale": {
"diverging": [
[
0,
"#8e0152"
],
[
0.1,
"#c51b7d"
],
[
0.2,
"#de77ae"
],
[
0.3,
"#f1b6da"
],
[
0.4,
"#fde0ef"
],
[
0.5,
"#f7f7f7"
],
[
0.6,
"#e6f5d0"
],
[
0.7,
"#b8e186"
],
[
0.8,
"#7fbc41"
],
[
0.9,
"#4d9221"
],
[
1,
"#276419"
]
],
"sequential": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"sequentialminus": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
]
},
"colorway": [
"#636efa",
"#EF553B",
"#00cc96",
"#ab63fa",
"#FFA15A",
"#19d3f3",
"#FF6692",
"#B6E880",
"#FF97FF",
"#FECB52"
],
"font": {
"color": "#2a3f5f"
},
"geo": {
"bgcolor": "white",
"lakecolor": "white",
"landcolor": "white",
"showlakes": true,
"showland": true,
"subunitcolor": "#C8D4E3"
},
"hoverlabel": {
"align": "left"
},
"hovermode": "closest",
"mapbox": {
"style": "light"
},
"paper_bgcolor": "white",
"plot_bgcolor": "white",
"polar": {
"angularaxis": {
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": ""
},
"bgcolor": "white",
"radialaxis": {
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": ""
}
},
"scene": {
"xaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
},
"yaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
},
"zaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
}
},
"shapedefaults": {
"line": {
"color": "#2a3f5f"
}
},
"ternary": {
"aaxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
},
"baxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
},
"bgcolor": "white",
"caxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
}
},
"title": {
"x": 0.05
},
"xaxis": {
"automargin": true,
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "#EBF0F8",
"zerolinewidth": 2
},
"yaxis": {
"automargin": true,
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "#EBF0F8",
"zerolinewidth": 2
}
}
},
"title": {
"text": "Degree Distribution of Gowalla Friendship Graph - Watts-Strogatz similarity"
},
"width": 800,
"xaxis": {
"title": {
"text": "Degree"
}
},
"yaxis": {
"title": {
"text": "Number of Nodes"
}
}
}
},
"text/html": [
"<div> <div id=\"764fe31c-da11-461c-8a4f-274a6af9776c\" class=\"plotly-graph-div\" style=\"height:600px; width:800px;\"></div> <script type=\"text/javascript\"> require([\"plotly\"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById(\"764fe31c-da11-461c-8a4f-274a6af9776c\")) { Plotly.newPlot( \"764fe31c-da11-461c-8a4f-274a6af9776c\", [{\"name\":\"Degree Distribution\",\"x\":[200,191,203,204,206,216,220,212,209,201,213,207,221,211,214,198,236,202,217,210,190,219,222,218,226,195,215,225,208,205,224,192,232,227,197,228,194,188,199,243,237,223,229,234,189,230,196,247,231,241,184,248,242,186,235,193,233,185,172,240,238,180,239,187,181,182],\"y\":[58,13,62,58,85,82,67,93,90,50,98,86,61,81,98,37,7,49,105,83,7,67,53,78,37,30,94,40,85,72,38,11,12,23,38,29,12,1,39,1,3,52,20,5,7,18,29,1,16,3,1,1,1,1,3,6,13,3,1,3,1,2,1,1,1,1],\"type\":\"bar\"}], {\"template\":{\"data\":{\"barpolar\":[{\"marker\":{\"line\":{\"color\":\"white\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"barpolar\"}],\"bar\":[{\"error_x\":{\"color\":\"#2a3f5f\"},\"error_y\":{\"color\":\"#2a3f5f\"},\"marker\":{\"line\":{\"color\":\"white\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"bar\"}],\"carpet\":[{\"aaxis\":{\"endlinecolor\":\"#2a3f5f\",\"gridcolor\":\"#C8D4E3\",\"linecolor\":\"#C8D4E3\",\"minorgridcolor\":\"#C8D4E3\",\"startlinecolor\":\"#2a3f5f\"},\"baxis\":{\"endlinecolor\":\"#2a3f5f\",\"gridcolor\":\"#C8D4E3\",\"linecolor\":\"#C8D4E3\",\"minorgridcolor\":\"#C8D4E3\",\"startlinecolor\":\"#2a3f5f\"},\"type\":\"carpet\"}],\"choropleth\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"choropleth\"}],\"contourcarpet\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"contourcarpet\"}],\"contour\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"contour\"}],\"heatmapgl\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"heatmapgl\"}],\"heatmap\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"heatmap\"}],\"histogram2dcontour\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"histogram2dcontour\"}],\"histogram2d\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"histogram2d\"}],\"histog
" \n",
"var gd = document.getElementById('764fe31c-da11-461c-8a4f-274a6af9776c');\n",
"var x = new MutationObserver(function (mutations, observer) {{\n",
" var display = window.getComputedStyle(gd).display;\n",
" if (!display || display === 'none') {{\n",
" console.log([gd, 'removed!']);\n",
" Plotly.purge(gd);\n",
" observer.disconnect();\n",
" }}\n",
"}});\n",
"\n",
"// Listen for the removal of the full notebook cells\n",
"var notebookContainer = gd.closest('#notebook-container');\n",
"if (notebookContainer) {{\n",
" x.observe(notebookContainer, {childList: true});\n",
"}}\n",
"\n",
"// Listen for the clearing of the current output cell\n",
"var outputEl = gd.closest('.output');\n",
"if (outputEl) {{\n",
" x.observe(outputEl, {childList: true});\n",
"}}\n",
"\n",
" }) }; }); </script> </div>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Foursquare Friendship Graph - Watts-Strogatz similarity\n",
"Number of nodes: 2324\n",
"Number of edges: 246344\n"
]
},
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"name": "Degree Distribution",
"type": "bar",
"x": [
193,
207,
202,
217,
236,
212,
2 years ago
213,
208,
2 years ago
211,
227,
225,
205,
194,
2 years ago
220,
222,
209,
2 years ago
221,
203,
215,
204,
2 years ago
210,
200,
199,
223,
231,
201,
214,
2 years ago
197,
235,
226,
219,
218,
192,
224,
228,
206,
216,
230,
196,
198,
186,
2 years ago
238,
190,
195,
2 years ago
229,
189,
188,
232,
2 years ago
191,
239,
2 years ago
233,
234,
180,
2 years ago
184,
185,
243,
2 years ago
240,
183,
2 years ago
244,
245,
2 years ago
187,
242,
237
],
"y": [
17,
88,
53,
83,
9,
81,
88,
97,
105,
35,
2 years ago
50,
76,
25,
2 years ago
66,
58,
2 years ago
61,
48,
66,
80,
58,
81,
48,
48,
52,
2 years ago
15,
58,
90,
33,
9,
2 years ago
46,
76,
69,
16,
45,
18,
90,
81,
2 years ago
20,
27,
37,
4,
2 years ago
2,
8,
19,
22,
5,
6,
12,
4,
2 years ago
6,
8,
11,
2,
1,
1,
2 years ago
1,
1,
2,
2 years ago
1,
1,
1,
1,
2
]
}
],
"layout": {
"height": 600,
"template": {
"data": {
"bar": [
{
"error_x": {
"color": "#2a3f5f"
},
"error_y": {
"color": "#2a3f5f"
},
"marker": {
"line": {
"color": "white",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "bar"
}
],
"barpolar": [
{
"marker": {
"line": {
"color": "white",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "barpolar"
}
],
"carpet": [
{
"aaxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "#C8D4E3",
"linecolor": "#C8D4E3",
"minorgridcolor": "#C8D4E3",
"startlinecolor": "#2a3f5f"
},
"baxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "#C8D4E3",
"linecolor": "#C8D4E3",
"minorgridcolor": "#C8D4E3",
"startlinecolor": "#2a3f5f"
},
"type": "carpet"
}
],
"choropleth": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "choropleth"
}
],
"contour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "contour"
}
],
"contourcarpet": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "contourcarpet"
}
],
"heatmap": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmap"
}
],
"heatmapgl": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmapgl"
}
],
"histogram": [
{
"marker": {
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "histogram"
}
],
"histogram2d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2d"
}
],
"histogram2dcontour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2dcontour"
}
],
"mesh3d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "mesh3d"
}
],
"parcoords": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "parcoords"
}
],
"pie": [
{
"automargin": true,
"type": "pie"
}
],
"scatter": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter"
}
],
"scatter3d": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter3d"
}
],
"scattercarpet": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattercarpet"
}
],
"scattergeo": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergeo"
}
],
"scattergl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergl"
}
],
"scattermapbox": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattermapbox"
}
],
"scatterpolar": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolar"
}
],
"scatterpolargl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolargl"
}
],
"scatterternary": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterternary"
}
],
"surface": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "surface"
}
],
"table": [
{
"cells": {
"fill": {
"color": "#EBF0F8"
},
"line": {
"color": "white"
}
},
"header": {
"fill": {
"color": "#C8D4E3"
},
"line": {
"color": "white"
}
},
"type": "table"
}
]
},
"layout": {
"annotationdefaults": {
"arrowcolor": "#2a3f5f",
"arrowhead": 0,
"arrowwidth": 1
},
"autotypenumbers": "strict",
"coloraxis": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"colorscale": {
"diverging": [
[
0,
"#8e0152"
],
[
0.1,
"#c51b7d"
],
[
0.2,
"#de77ae"
],
[
0.3,
"#f1b6da"
],
[
0.4,
"#fde0ef"
],
[
0.5,
"#f7f7f7"
],
[
0.6,
"#e6f5d0"
],
[
0.7,
"#b8e186"
],
[
0.8,
"#7fbc41"
],
[
0.9,
"#4d9221"
],
[
1,
"#276419"
]
],
"sequential": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"sequentialminus": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
]
},
"colorway": [
"#636efa",
"#EF553B",
"#00cc96",
"#ab63fa",
"#FFA15A",
"#19d3f3",
"#FF6692",
"#B6E880",
"#FF97FF",
"#FECB52"
],
"font": {
"color": "#2a3f5f"
},
"geo": {
"bgcolor": "white",
"lakecolor": "white",
"landcolor": "white",
"showlakes": true,
"showland": true,
"subunitcolor": "#C8D4E3"
},
"hoverlabel": {
"align": "left"
},
"hovermode": "closest",
"mapbox": {
"style": "light"
},
"paper_bgcolor": "white",
"plot_bgcolor": "white",
"polar": {
"angularaxis": {
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": ""
},
"bgcolor": "white",
"radialaxis": {
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": ""
}
},
"scene": {
"xaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
},
"yaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
},
"zaxis": {
"backgroundcolor": "white",
"gridcolor": "#DFE8F3",
"gridwidth": 2,
"linecolor": "#EBF0F8",
"showbackground": true,
"ticks": "",
"zerolinecolor": "#EBF0F8"
}
},
"shapedefaults": {
"line": {
"color": "#2a3f5f"
}
},
"ternary": {
"aaxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
},
"baxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
},
"bgcolor": "white",
"caxis": {
"gridcolor": "#DFE8F3",
"linecolor": "#A2B1C6",
"ticks": ""
}
},
"title": {
"x": 0.05
},
"xaxis": {
"automargin": true,
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "#EBF0F8",
"zerolinewidth": 2
},
"yaxis": {
"automargin": true,
"gridcolor": "#EBF0F8",
"linecolor": "#EBF0F8",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "#EBF0F8",
"zerolinewidth": 2
}
}
},
"title": {
"text": "Degree Distribution of Foursquare Friendship Graph - Watts-Strogatz similarity"
},
"width": 800,
"xaxis": {
"title": {
"text": "Degree"
}
},
"yaxis": {
"title": {
"text": "Number of Nodes"
}
}
}
},
"text/html": [
"<div> <div id=\"6b07fa24-4d22-40e7-a3eb-eb645c47b972\" class=\"plotly-graph-div\" style=\"height:600px; width:800px;\"></div> <script type=\"text/javascript\"> require([\"plotly\"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById(\"6b07fa24-4d22-40e7-a3eb-eb645c47b972\")) { Plotly.newPlot( \"6b07fa24-4d22-40e7-a3eb-eb645c47b972\", [{\"name\":\"Degree Distribution\",\"x\":[193,207,202,217,236,212,213,208,211,227,225,205,194,220,222,209,221,203,215,204,210,200,199,223,231,201,214,197,235,226,219,218,192,224,228,206,216,230,196,198,186,238,190,195,229,189,188,232,191,239,233,234,180,184,185,243,240,183,244,245,187,242,237],\"y\":[17,88,53,83,9,81,88,97,105,35,50,76,25,66,58,61,48,66,80,58,81,48,48,52,15,58,90,33,9,46,76,69,16,45,18,90,81,20,27,37,4,2,8,19,22,5,6,12,4,6,8,11,2,1,1,1,1,2,1,1,1,1,2],\"type\":\"bar\"}], {\"template\":{\"data\":{\"barpolar\":[{\"marker\":{\"line\":{\"color\":\"white\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"barpolar\"}],\"bar\":[{\"error_x\":{\"color\":\"#2a3f5f\"},\"error_y\":{\"color\":\"#2a3f5f\"},\"marker\":{\"line\":{\"color\":\"white\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"bar\"}],\"carpet\":[{\"aaxis\":{\"endlinecolor\":\"#2a3f5f\",\"gridcolor\":\"#C8D4E3\",\"linecolor\":\"#C8D4E3\",\"minorgridcolor\":\"#C8D4E3\",\"startlinecolor\":\"#2a3f5f\"},\"baxis\":{\"endlinecolor\":\"#2a3f5f\",\"gridcolor\":\"#C8D4E3\",\"linecolor\":\"#C8D4E3\",\"minorgridcolor\":\"#C8D4E3\",\"startlinecolor\":\"#2a3f5f\"},\"type\":\"carpet\"}],\"choropleth\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"choropleth\"}],\"contourcarpet\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"contourcarpet\"}],\"contour\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"contour\"}],\"heatmapgl\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"heatmapgl\"}],\"heatmap\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"heatmap\"}],\"histogram2dcontour\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"histogram2dcontour\"}],\"histogram2d\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"histogram2d\"}],\"histogram\":[{\"marker\"
" \n",
"var gd = document.getElementById('6b07fa24-4d22-40e7-a3eb-eb645c47b972');\n",
"var x = new MutationObserver(function (mutations, observer) {{\n",
" var display = window.getComputedStyle(gd).display;\n",
" if (!display || display === 'none') {{\n",
" console.log([gd, 'removed!']);\n",
" Plotly.purge(gd);\n",
" observer.disconnect();\n",
" }}\n",
"}});\n",
"\n",
"// Listen for the removal of the full notebook cells\n",
"var notebookContainer = gd.closest('#notebook-container');\n",
"if (notebookContainer) {{\n",
" x.observe(notebookContainer, {childList: true});\n",
"}}\n",
"\n",
"// Listen for the clearing of the current output cell\n",
"var outputEl = gd.closest('.output');\n",
"if (outputEl) {{\n",
" x.observe(outputEl, {childList: true});\n",
"}}\n",
"\n",
" }) }; }); </script> </div>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"for graph in friendships_graph:\n",
"\n",
" p = G.number_of_edges() / (G.number_of_nodes())\n",
" avg_degree = int(np.mean([d for n, d in G.degree()]))\n",
" G = nx.watts_strogatz_graph(G.number_of_nodes(), avg_degree, p)\n",
" G.name = graph.name + \" - Watts-Strogatz similarity\"\n",
"\n",
"\n",
" print(G.name)\n",
" print(\"Number of nodes: \", G.number_of_nodes())\n",
" print(\"Number of edges: \", G.number_of_edges())\n",
2 years ago
" degree_distribution(G, log=False)"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"This is a Poissonian distribution, as expected from a random network. "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## <a id='toc5_2_'></a>[The Small-World Model](#toc0_)\n",
"\n",
2 years ago
"It is imperative to note that real networks are not random, but rather the result of a multitude of processes and influences including natural limitations, human considerations, and economic factors among others. The degree to which random models accurately depict real-world networks remains a topic of debate. Nonetheless, this section focuses on random network models and investigates if their properties may still be applicable to the study of real-world networks.\n",
"\n",
2 years ago
"The ER model fails to explain several properties of real-world networks, such as the high clustering. To address this issue, Watts and Strogatz proposed an alternative model, referred to as the “small-world” model `[3]`. The model aims to combine the characteristics of ordered lattices with those of random graphs. According to Watts and Strogatz, quoting their words:\n",
"\n",
2 years ago
"> small-world networks exhibit high clustering like regular lattices and small characteristic path lengths like random graphs. \n",
"\n",
2 years ago
"The model begins with an ordered lattice, such as the $k$-ring or the two-dimensional lattice, and rewires links with probability $\\varphi$. The result is a network with specialized nodes or regions and shared or distributed processing across all communicating nodes.\n",
"\n",
"![small-world](https://i.imgur.com/gX4Eutx.png)\n",
2 years ago
"![small-world](https://i.imgur.com/B95uS5O.png)\n",
"\n",
"_Pictures from `[2]`_"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## <a id='toc5_3_'></a>[Small-Worldness](#toc0_)\n",
"\n",
"We need to ascertain whether the small-world properties of networks, characterized by their high clustering and low path length, are a universal property of naturally occurring networks or restricted to specific networks. The broad definition of small-worldness may overlook the specific advantages of these networks, resulting in the misidentification of networks more similar to regular lattices and random networks as small-world. A commonly accepted definition of small-world networks is that they exhibit clustering coefficients comparable to a regular lattice and path lengths comparable to a random network. However, this definition can lead to networks with low clustering coefficients being incorrectly classified as small-world. Therefore, a more stringent method is necessary to differentiate true small-world networks from those resembling random or lattice structures, which, although interesting in their own right, do not exhibit the characteristics of small-world networks.`[6]`"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## <a id='toc5_4_'></a>[Identifying small-world networks](#toc0_)\n",
"\n",
"Small-world networks are distinguished from other networks by two specific properties, the first being high clustering ($C$) among nodes. Conceptually, clustering is quite straightforward to comprehend. In a real-world analogy, clustering represents the probability that ones friends are also friends of each other.\n",
"\n",
"Small-world networks also have short path lengths ($L$) as is commonly observed in random networks. The path length is a measure of the distance between nodes in the network, calculated as the mean of the shortest geodesic distances between all possible node pairs. Small values of $L$ ensure that information or resources easily spreads throughout the network. This property makes distributed information processing possible on technological networks and supports the six degrees of separation often reported in social networks. `[6]`\n",
"\n",
"The WS model `[3]` demonstrates that random rewiring of a small percentage of the edges in a lattice results in a precipitous decrease in the path length, but only trivial reductions in the clustering. Across this rewiring probability, there is a range where the discrepancy between clustering and path length is very large, and it is in this area that the benefits of small-world networks are realized."
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"### <a id='toc5_4_1_'></a>[A first approach: the $\\sigma$ coefficient](#toc0_)\n",
"\n",
2 years ago
"In 2006, Humphries et al. `[8][9]` proposed the small-world coefficient $\\sigma$ as a quantitative metric for network analysis. This metric quantifies the relationship between network clustering, represented by $C$, and path length, represented by $L$, in comparison to their respective random network equivalents, $C_{rand}$ and $L_{rand}$. To calculate $\\sigma$, the authors computed the ratios $c = C/C_{rand}$ and $k = L/L_{rand}$ and arrived at the following equation:\n",
"\n",
"$$ \\sigma = \\frac{C/C_{rand}}{L/L_{rand}}$$\n",
2 years ago
"\n",
"A network is classified as small-world if $C \\gg C_{rand}$ and $L \\approx L_{rand}$, resulting in $\\sigma > 1$. However, a limitation of this metric is its susceptibility to the clustering coefficient of the equivalent random network. As clustering in random networks is typically low `[3]`, small changes in $C_{rand}$ can significantly impact the value of $\\sigma$."
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"### <a id='toc5_4_2_'></a>[A more solid approach: the $\\omega$ coefficient](#toc0_)\n",
"\n",
2 years ago
"The small-world measurement, $\\omega$, quantifies the structural properties of a graph with characteristic path length, $L$, and clustering, $C$. The metric calculates the difference between the ratio of the graph's path length to that of an equivalent random network, $L_{rand}$, and the ratio of the graph's clustering to that of an equivalent lattice network, $C_{latt}$; as expressed in the following equation:\n",
"\n",
"$$ \\omega = \\frac{L_{rand}}{L} - \\frac{C}{C_{latt}} $$\n",
"\n",
"The utilization of the clustering of an equivalent lattice network, rather than a random network, renders $\\omega$ less susceptible to fluctuations in $C_{rand}$. _Furthermore, values of $\\omega$ are restricted to the interval $-1$ to $1$ regardless of network size._\n",
2 years ago
"\n",
"> **NOTE:** The authors in reference `[6]`, as far as I get, fail to provide adequate justification for the restriction interval affirmation. \n",
"\n",
"Graphs with $\\omega$ values close to zero are considered small world, while positive values denote more random-like characteristics and negative values denote more regular, or lattice-like, characteristics."
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"#### <a id='toc5_4_2_1_'></a>[Lattice network construction](#toc0_)\n",
"\n",
2 years ago
"The paper `[11]` presents the generation of a lattice network through the application of a modified version of the \"latticization\" algorithm `[10]` as reported in the brain connectivity toolbox by Rubinov and Sporns (2010). This procedure, based on a Markov-chain algorithm, preserves node degree while swapping edges with uniform probability, under the condition that the resulting matrix has entries closer to the main diagonal.\n",
"\n",
"In order to optimize the clustering coefficient of the lattice network, the latticization process undergoes several repetitions until clustering is maximized. The algorithm involves storing the initial adjacency matrix and its clustering coefficient. The latticization procedure is then performed on the matrix. If the clustering coefficient of the resulting matrix is higher, it replaces the initial adjacency matrix. If it is lower, the latticization process repeats on the initial matrix.\n",
"\n",
"This process results in a highly clustered network with long path length, approximating a lattice topology. To reduce processing time in larger networks, the authors developed a \"sliding window\" procedure. The procedure involves sampling smaller sections of the matrix along the main diagonal, performing the latticization process, and reinserting the result into the larger matrix in a step-wise manner."
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"#### <a id='toc5_4_2_2_'></a>[Limitations](#toc0_)\n",
"\n",
"The latticization procedure, as described by Sporns and Zwi in 2004 et. al `[10]`, exhibits limitations in its applicability to large networks. Due to the computational demands, the latticization of such networks may take several days to generate and optimize.\n",
2 years ago
"\n",
2 years ago
"Additionally, the latticization algorithm is limited by networks that possess low clustering and lack the capacity for appreciable improvement. Such networks include those with 'super hubs' or hierarchical structures. Hierarchical networks often feature nodes that are configured in branches with minimal clustering, while networks with 'super hubs' contain a node with a degree magnitude significantly greater than that of the next most connected node. These configurations restrict the options for increasing the clustering of the network. Furthermore, a targeted attack on these networks can easily destroy `[17]` its topology, indicating a potential lack of small-world properties."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### <a id='toc5_4_3_'></a>[Omega coefficient computation: standard procedure](#toc0_)\n",
"\n",
"The computation of the Omega Coefficient is a time-consuming process. To accurately assess the clustering coefficient and the shortest path length, one must construct both the lattice reference network and the random reference network several times. \n",
"\n",
"To mitigate over-sampling and potential bias, the computation was performed on a subset of the network with half the number of nodes. Additionally, both \n",
"the number of rewiring operations per edge and the number of random graphs were set to $3$. For further information refer to the paper `[6]` and the networkx documentation for the `omega` function.\n",
2 years ago
"\n",
"Even with these optimizations, the computation of the Omega Coefficient required several days to complete. The computation was executed on a remote server, and the results are accessible in the last column of the dataframe that we downloaded in the previous section."
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"---\n",
"\n",
"In this repository there is a python script called `omega_sampled_server.py` that can be used to compute the omega coefficient for a network as described above. You can run it as follows:\n",
"\n",
"```bash\n",
"./omega_sampled_server.py graph --k --niter --nrand\n",
"\n",
"# Example:\n",
"./omega_sampled_server.py checkins-brightkite --k 0.5 --nrand 3 --niter 3\n",
"```\n",
"\n",
"Where: \n",
"\n",
"- `graph` is the name of the graph\n",
"- `k` Percentage of nodes to be remove\n",
"- `niter` Number of rewiring operations per edge\n",
"- `nrand` Number of random graphs to be generated\n",
"\n",
"For further details run `./omega_sampled_server.py --help`\n",
"\n",
"> **NOTE:** This are slow operations, do not try to run them with low samplings or high values for niter or nrand. The computation of some networks with `k=0.5`, `niter=3` and `nrand=3` requires up to 10 days to complete. If you want to test it out, you can use the `checkins-brightkite` graph with `k=0.95`, `niter=3` and `nrand=3`. This will take about 1 minute to complete.\n",
"\n",
"The advantage of using an external script rather then a block in the notebook is the ease of parallelization. You can run more scripts in parallel for different datasets. This can easily be automated with a bash script. I won't report the code since it's note relevant to the topic of this project.\n",
"\n",
"In the next section, we will see the results obtained in detail, trying to understand what they mean. If you want to test it out on small-graphs, you can run it in the notebook using the function present in the `utils` module.\n"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Graph is not connected. Taking the largest connected component\n",
"Number of nodes in the sampled graph: 194\n",
"Number of edges in the sampled graph: 296\n",
"Omega-coefficient: -0.17678674427140695\n"
]
}
],
"source": [
"# it takes about 40 seconds to run this block with this parameters\n",
"\n",
"omega = omega_sampled(G_brighkite_checkins, k = 0.97, niter = 6, nrand = 6)\n",
"print(\"Omega-coefficient: \", omega)"
]
},
2 years ago
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### <a id='toc5_4_4_'></a>[Omega coefficient computation: parallelization approach (experimental)](#toc0_)\n",
2 years ago
"\n",
"The algorithm described above can be ~~easly~~ parallelized. Since we want to compute `nrand` times the random reference and the lattice, we can use different processes to compute them in parallel. This can be done with the `multiprocessing` module in python. \n",
2 years ago
"\n",
"It the repository there is a python program `omega_parallel_server.py` that can be used to compute the omega coefficient for a network as described above. You can run it as follows:\n",
"\n",
"```bash\n",
"./omega_sampled_parallel.py graph --k --niter --nrand --n_processes --seed\n",
"```\n",
"\n",
"Where `--n_processes` is an argument that specifies the number of processes to be used. I suggest to use the default option that uses all the available threads. If we use a number of `nrand` that is less then or equal to the number of threads, the time needed to compute the omega coefficient will be the same as choosing `nrand=1` with the previous script. \n",
"\n",
"This was not easy to implement! Go check out the code in the `utils` module if you want to see how it works. We can test it out with the `checkins-brightkite` graph with `k=0.95`, `niter=6` and `nrand=6`. This will take just a few seconds to complete."
]
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Graph is not connected. Taking the largest connected component\n",
"Number of nodes in the sampled graph: 190\n",
"Number of edges in the sampled graph: 258\n",
"Omega-coefficient: -0.741394750422215\n"
]
}
],
"source": [
"# check this function in utils.py\n",
"omega = parallel_omega(G_brighkite_checkins, k = 0.97, niter=6, nrand=6, seed=42) \n",
"print(\"Omega-coefficient: \", omega)\n",
"\n",
"# notice how this function is about ~nrand times faster than the previous one! Check at your cpu usage to see how that it's actually parallel"
2 years ago
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### <a id='toc5_4_4_1_'></a>[Why experimental?](#toc0_)\n",
"\n",
"Since this is a far more efficient function, I was able to test it with larger graphs and higher values for `niter` and `nrand`. I have encountered cases where the omega coefficient was not in the range $[-1,1]$ that the authors of the paper `[6]` report. Due to lack of time, I was not able to investigate this issue further and marked this function as experimental. The analysis of the results will be conducted with the previous function to avoid any bias in the case that my parallel implementation is not correct.\n",
"\n",
"If you find any issues in the code, please let me know!"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## <a id='toc5_5_'></a>[Are our networks small-world?](#toc0_)\n",
"\n",
"There are multiple factors to take into consideration. Let's try to recap what we know about the networks we are working with:\n",
"\n",
"- Degree distribution\n",
"- Average clustering coefficient\n",
"- Average shortest path length\n",
"- Betweenness centrality\n",
"- Omega coefficient"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## <a id='toc5_6_'></a>[Degree distribution](#toc0_)\n",
"\n",
"The degree distribution of a real-world network can characterize the small-world property by showing a balance between the number of highly connected nodes (high degree) and the number of less connected nodes (low degree). A network with a small-world property will have a few highly connected nodes (hubs) and a large number of nodes with a relatively low number of connections. This creates a balance between the number of highly connected nodes and the number of less connected nodes, which allows for efficient information flow and rapid spreading of information throughout the network. Additionally, the degree distribution of a small-world network will typically follow a power-law distribution, with a few highly connected nodes and a large number of less connected nodes, further emphasizing the small-world property.\n",
"\n",
"As we have seen from the sections before, the distribution presented is far form Poissonian, and very close to a power law. However, the degree distribution alone is not enough to state that a real-world network is a small-world network because it does not take into account the specific relationships and interactions between the nodes in the network. A random network can also have a similar degree distribution, but the relationships between the nodes would be different from those in a small-world network.\n",
"\n",
"For example, a random network could be generated by randomly connecting nodes together without considering any specific relationships between them. In this case, the degree distribution may be similar to that of a social network, but the relationships between the nodes would be different.\n",
"\n",
"Additionally, to recreate this degree distribution with a random network, we can use the Barabasi-Albert model. This model generates a random network with a power-law degree distribution, which is similar to the degree distribution found in many real-world networks, including small-world networks. This model simulates the growth process of a network, where new nodes are added to the network and they preferentially connect to the existing nodes that have a high degree, this leads to a power-law degree distribution which is similar to the degree distribution of many small-world networks."
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## <a id='toc5_7_'></a>[Betweenness centrality](#toc0_)\n",
"\n",
"The betweenness centrality of a node in a network measures the number of times that node acts as a bridge or intermediary between other nodes in the network. In a small-world network, nodes have a high betweenness centrality because they often act as intermediaries between distant nodes, allowing for short paths and efficient communication between distant parts of the network. Therefore, a high degree of betweenness centrality in a network can be used to characterize its small-world propriety.\n",
"\n",
"To determine if the average betweenness centrality of a network is high or not we can compare it with the theoretical values of random networks. As the betweenness centrality is a measure of how much a node is used as a bridge between other nodes, random networks tend to have a low value of betweenness centrality. If the average betweenness centrality of our network is higher than the theoretical values of a random network, it can be considered a high value and therefore the network is more likely to be a small-world network.\n",
"\n",
"Let's test it out with our networks:"
]
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Creating a random graph with the Erdos-Renyi model Brightkite Checkins Graph\n",
"Random graph created for Brightkite Checkins Graph \n",
"Starting computation of betweenness centrality...\n",
"\tNumber of nodes after removing 40.0% of nodes: 3896\n",
2 years ago
"\tNumber of edges after removing 40.0% of nodes: 105304\n",
"\tBetweenness centrality for Erdos-Renyi random graph: 0.0003728390172657916\n",
"\n",
"Creating a random graph with the Erdos-Renyi model Gowalla Checkins Graph\n",
"Random graph created for Gowalla Checkins Graph \n",
"Starting computation of betweenness centrality...\n",
"\tNumber of nodes after removing 40.0% of nodes: 1844\n",
2 years ago
"\tNumber of edges after removing 40.0% of nodes: 22543\n",
"\tBetweenness centrality for Erdos-Renyi random graph: 0.0009239069377213959\n",
"\n",
"Creating a random graph with the Erdos-Renyi model Foursquare Checkins Graph\n",
"Random graph created for Foursquare Checkins Graph \n",
"Starting computation of betweenness centrality...\n",
"\tNumber of nodes after removing 40.0% of nodes: 1395\n",
2 years ago
"\tNumber of edges after removing 40.0% of nodes: 89088\n",
"\tBetweenness centrality for Erdos-Renyi random graph: 0.0006521059583381414\n",
"\n",
"Creating a random graph with the Erdos-Renyi model Brightkite Friendship Graph\n",
"Random graph created for Brightkite Friendship Graph \n",
"Starting computation of betweenness centrality...\n",
2 years ago
"\tNumber of nodes after removing 40.0% of nodes: 900\n",
"\tNumber of edges after removing 40.0% of nodes: 416\n",
"\tBetweenness centrality for Erdos-Renyi random graph: 0.0001470935150524697\n",
"\n",
"Creating a random graph with the Erdos-Renyi model Gowalla Friendship Graph\n",
"Random graph created for Gowalla Friendship Graph \n",
"Starting computation of betweenness centrality...\n",
2 years ago
"\tNumber of nodes after removing 40.0% of nodes: 900\n",
"\tNumber of edges after removing 40.0% of nodes: 812\n",
"\tBetweenness centrality for Erdos-Renyi random graph: 0.00550616195123455\n",
"\n",
"Creating a random graph with the Erdos-Renyi model Foursquare Friendship Graph\n",
"Random graph created for Foursquare Friendship Graph \n",
"Starting computation of betweenness centrality...\n",
"\tNumber of nodes after removing 40.0% of nodes: 839\n",
2 years ago
"\tNumber of edges after removing 40.0% of nodes: 1881\n",
"\tBetweenness centrality for Erdos-Renyi random graph: 0.004324601656478056\n",
"\n"
]
}
],
"source": [
"# As said before, for a quick testing I suggest to use k=0.6 and at least k=0.4 for accurate results\n",
"\n",
"# uncomment the model that you want to use for the random graphs\n",
"# model_name = 'watts_strogatz'\n",
"model_name = 'erdos_renyi'\n",
"\n",
"random_graphs = {}\n",
"for graph in graphs_all:\n",
" G = create_random_graphs(graph, model=model_name, save = False)\n",
" print(\"Random graph created for \", graph.name, \"\\nStarting computation of betweenness centrality...\")\n",
" betweenness_centrality = np.mean(list(betweenness_centrality_parallel(G, 6, k = 0.4).values()))\n",
" print(\"\\tBetweenness centrality for Erdos-Renyi random graph: \", betweenness_centrality)\n",
" random_graphs[graph.name] = betweenness_centrality\n",
" print(\"\")"
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABcIAAAPdCAYAAACp3hugAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8o6BhiAAAACXBIWXMAAA9hAAAPYQGoP6dpAACtnElEQVR4nOzdd5gV5fk//ntpS0dAadJFKQKioAgJAqI0e4nEgmDHhthjIaLREKNRY0XsFfETuyJNhBhZFRSwIZagoIIoCihKn98f+XG+rkvZA7uujq/XdZ3rynnmnpl7Zs+cJG8fn5OTJEkSAAAAAACQUqVKugEAAAAAAChOgnAAAAAAAFJNEA4AAAAAQKoJwgEAAAAASDVBOAAAAAAAqSYIBwAAAAAg1QThAAAAAACkmiAcAAAAAIBUE4QDAAAAAJBqgnAA+AW79957IycnJ99ru+22i27dusWzzz67xce99dZb49577y26RsnKsmXL4qqrrooOHTpE1apVIzc3Nxo3bhzHH398vPHGG8V67ocffjhuuOGGYjt+48aNY+DAgZn3H3/8ceTk5OT7vE2dOjWGDRsWS5YsKbY+Nuemm26KZs2aRbly5SInJ2ejvWyq18aNG8f+++9fvI0WkW7dukW3bt22aN9hw4ZFTk5O0Ta0ATk5OTFs2LBiP09x+bV8Htb/98rHH3+8yboxY8Zs9O+Rk5MTZ5xxRtE39wtU2PvFb+tzAcCvkyAcAH4F7rnnnsjLy4upU6fGyJEjo3Tp0nHAAQfEM888s0XHE4SXnI8++ih23XXX+Nvf/hbdu3ePUaNGxfjx4+Pyyy+PL774Itq3bx9Lly4ttvMXdxD+U3Xr1o28vLzYb7/9MmNTp06Nyy+/vMSC8JkzZ8bgwYOje/fuMWnSpMjLy4sqVapssLakey0qt956a9x6661btO+JJ54YeXl5RdwRv3RjxoyJyy+/vKTbAAAoMmVKugEAYPNat24dHTp0yLzv3bt3VK9ePUaNGhUHHHBACXZGNtauXRuHHHJIfPXVV5GXlxetW7fObOvatWsMGDAgnn/++ShbtmwJdvn/rF27NtasWRO5ublbfIzc3NzYc889i7CrrffOO+9ERMRJJ50Ue+yxRwl3U7y+//77qFixYrRq1WqLj1G/fv2oX79+EXZVctbfD36dkiSJFStWRIUKFUq6lV8tzwAAv2VmhAPAr1D58uWjXLlyBQLTVatWxZVXXhktWrSI3Nzc2G677eK4446LL7/8MlPTuHHjeOedd2LKlCmZ5VYaN24cSZJE7dq14/TTT8/Url27NqpXrx6lSpWKL774IjN+3XXXRZkyZfLNkp0+fXoceOCBUaNGjShfvnzsuuuu8eijjxbofeHChXHKKadE/fr1o1y5ctGkSZO4/PLLY82aNZma9ctpXHvttXHddddFkyZNonLlytGpU6d45ZVX8h1v4MCBUbly5fjwww+jb9++Ubly5WjQoEGce+65sXLlyqzvT0TEpEmTolu3blGzZs2oUKFCNGzYMA477LD4/vvvMzW33XZb7LLLLlG5cuWoUqVKtGjRIi6++OJN/dniySefjLfeeisuuuiifCH4j/Xp0ydfSPHBBx/EUUcdFbVq1Yrc3Nxo2bJl3HLLLfn2mTx5cuTk5MSoUaPikksuiXr16kXVqlVjn332iTlz5mTqunXrFs8991x88skn+Zbb+fE9//vf/x5XXnllNGnSJHJzc+PFF1+MFStWxLnnnhvt2rWLatWqRY0aNaJTp07x1FNPbfJ6f3zc9f8GwrBhw+L888+PiIgmTZpkepg8eXKccMIJUaNGjXz3eb299947dt55582e7+67745ddtklypcvHzVq1IhDDjkkZs+ene8eHHPMMRER0bFjx8jJycm3lMuPbarXHxs7dmzstttuUaFChWjRokXcfffdBY5VmM/9xqxbty7+/ve/Zz63tWrVimOPPTY+/fTTfHXdunWL1q1bx7///e/o3LlzVKxYMY4//vjMtp8ujfLpp5/G4YcfHlWqVIltttkmjj766Jg2bVqBpWw2tDTK+mVANnftX375ZZx22mnRqlWrqFy5ctSqVSv23nvveOmllzZ73RtT2L7Xfze89dZb0bNnz6hSpUr06NEjIiImTJgQBx10UNSvXz/Kly8fzZo1i1NOOSW++uqrfOdaf+0zZsyIQw89NKpWrRrVqlWLY445psD3xnqF+TxsyOWXXx4dO3aMGjVqRNWqVWO33XaLu+66K5IkyVdX2HsfEfHKK6/E7373uyhfvnzUq1cvLrrooli9evVmexk4cGDme+bH3xU/XR7kgQceiJYtW0bFihVjl1122eCSXYX5DtuY9UttjBgxIlq2bBm5ublx3333lfj9yvaZzMvLi86dO0eFChWicePGcc8990RExHPPPRe77bZbVKxYMdq0aRNjx44t1H155513omfPnlGxYsXYbrvt4vTTT4/nnnuuwPfTpr4TRo8eHT179oy6detGhQoVomXLlvGnP/0pli9fnu9c65+jd955J3r06BGVKlWK7bbbLs4444wNfldHFO5zAQAlIgEAfrHuueeeJCKSV155JVm9enWyatWqZP78+cngwYOTUqVKJWPHjs3Url27Nundu3dSqVKl5PLLL08mTJiQ3Hnnncn222+ftGrVKvn++++TJEmSN954I2natGmy6667Jnl5eUleXl7yxhtvJEmSJH/84x+TnXbaKXPMV155JYmIpEKFCslDDz2UGe/Tp0+yxx57ZN5PmjQpKVeuXNKlS5dk9OjRydixY5OBAwcmEZHcc889mboFCxYkDRo0SBo1apTcfvvtycSJE5O//OUvSW5ubjJw4MBM3dy5c5OISBo3bpz07t07efLJJ5Mnn3wyadOmTVK9evVkyZIlmdoBAwYk5cqVS1q2bJlce+21ycSJE5M///nPSU5OTnL55ZdnfX/mzp2blC9fPtl3332TJ598Mpk8eXLy0EMPJf3790+++eabJEmSZNSoUUlEJGeeeWYyfvz4ZOLEicmIESOSwYMHb/LvefLJJycRkcyePXuzf/skSZJ33nknqVatWtKmTZvk/vvvT8aPH5+ce+65SalSpZJhw4Zl6l588cXM/Tr66KOT5557Lhk1alTSsGHDZMcdd0zWrFmTOd7vfve7pE6dOpm/fV5eXr57vv322yfdu3dP/vWvfyXjx49P5s6dmyxZsiQZOHBg8sADDySTJk1Kxo4dm5x33nlJqVKlkvvuuy9fz40aNUoGDBhQ4G+5/nMwf/785Mwzz0wiInn88cczPSxdujSZNWtWEhHJHXfcUeA+RERyyy23bPJ+/fWvf00iIjnyyCOT5557Lrn//vuTpk2bJtWqVUvef//9zLEuvfTSTE95eXnJhx9+uMHjbarX9ddav379pFWrVsn999+fjBs3LvnDH/6QREQyZcqUzHEK+7nfmPWfmzPOOCMZO3ZsMmLEiGS77bZLGjRokHz55ZeZuq5duyY1atRIGjRokNx0003Jiy++mOmja9euSdeuXTO13333XdKsWbOkRo0ayS233JKMGzcuOfvss5MmTZoUeG4vu+yy5Kf/t6Gw1/7ee+8lp556avLII48kkydPTp599tnkhBNOSEqVKpW8+OKL+Y4ZEclll122yXuRTd8DBgxIypYtmzRu3DgZPnx48sILLyTjxo1LkiRJbrvttmT48OHJ008/nUyZMiW57777kl122SVp3rx5smrVqgLX3qhRo+T8889Pxo0bl1x33XVJpUqVkl133TVfbWHvycYMHDgwueuuu5IJEyYkEyZMSP7yl78kFSpUyPc9ls153nnnnaRixYpJq1atklGjRiVPPfVU0qtXr6Rhw4ZJRCRz587daC8ffvhhcvjhhycRke+7YsWKFUmSJJnvmz322CN59NFHkzFjxiTdunVLypQpk3z00Uf5eijMd9jGrP9Oatu2bfLwww8nkyZNSt5+++0Sv1/ZPJM1a9ZMmjdvntx1113JuHHjkv333z+JiOTyyy9P2rRpk4waNSoZM2ZMsueeeya5ubnJZ599tsl78vnnnyc1a9ZMGjZ
"text/plain": [
"<Figure size 1500x1000 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import matplotlib.pyplot as plt\n",
"\n",
"fig, ax = plt.subplots(figsize=(15, 10))\n",
"index = np.arange(len(random_graphs))\n",
"bar_width = 0.35\n",
"opacity = 0.8\n",
"\n",
"rects1 = plt.bar(index, analysis_results['betweenness centrality'], bar_width,\n",
"alpha=opacity,\n",
"color='b',\n",
"label='Original Graph')\n",
"\n",
"rects2 = plt.bar(index + bar_width, random_graphs.values(), bar_width,\n",
"alpha=opacity,\n",
"color='g',\n",
"label='Random Graph')\n",
"\n",
"plt.xlabel('Graph')\n",
"plt.ylabel('Betweenness Centrality')\n",
"plt.title('Betweenness Centrality of the original graph and the random graph')\n",
"plt.xticks(index + bar_width, random_graphs.keys())\n",
"plt.legend()\n",
"\n",
"plt.tight_layout()\n",
"plt.show()"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"We can observe a marked distinction between the betweenness centrality of the networks generated from checkins and the networks generated from friendships. As the values of the betweenness centrality of the networks generated from checkins surpass the theoretical values of a random network, we can deduce that these networks generated from checkins exhibit a higher probability of being a small-world network. Conversely, the networks generated from friendships display a lower value of betweenness centrality than the theoretical values of a random network, thus indicating a lower likelihood of being a small-world network.\n",
"\n",
"This property is consistent across both the Erdös-Rényi and Watts-Strogatz models."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## <a id='toc5_8_'></a>[Clustering coefficient](#toc0_)\n",
"\n",
"The simplest `[5]` analytical treatment of clustering in a small-world network involves the use of the link addition model, as opposed to the rewiring model. As the network size $N$ approaches infinity and the fraction of shortcuts $\\phi$ remains fixed, the probability of forming a triangle vanishes and the contribution of shortcuts to the clustering becomes negligible. As a result, the clustering of a small-world network is determined by its underlying ordered lattice.\n",
"\n",
"As an example, consider a ring network where each node is connected to its $k$ closest neighbors on each side. The number of neighbors for a node is $2k$, resulting in $k(2k-1)$ pairs of neighbors. If we consider a node $i$, the $k$ nearest nodes on $i$'s left are connected to each other, as are the nodes on $i$'s right. This results in $k(k-1)$ pairs. If we consider a node located $d$ places to the left of node $i$, it will be connected to $k-d$ neighbors on $i$'s right side. The total number of connected neighbor pairs is $\\frac{3}{2} k (k-1)$.\n",
"\n",
"Therefore, the clustering coefficient $C$ can be calculated as follows:\n",
"\n",
"$$ C = \\frac{\\frac{3}{2}k(k-1)}{k(2k-1)} =\\frac{3 (k-1)}{2(2k-1)} $$\n",
"\n",
"For all values of $k > 1$, this results in a constant larger than $0$, indicating that the clustering of a small-world network does not vanish for large networks. For large values of $k$, the clustering coefficient approaches $\\frac{3}{4}$, signifying a very high clustering. It is important to note that for a regular two-dimensional grid, the clustering is defined as zero, since no triangles exist. However, the grid still has a neighborhood structure. `[2]`\n",
"\n",
"---\n",
"\n",
"We can compare the results of the clustering coefficient obtained through the standard formula and the formula derived above by utilizing the function `generalized_average_clustering_coefficient` in the `utils` module. This function takes a networkx graph object as input and returns the average clustering coefficient of the graph as a float."
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {},
"outputs": [],
"source": [
"generalized_cc = {}\n",
"for graph in graphs_all:\n",
" generalized_cc[graph.name] = generalized_average_clustering_coefficient(graph)"
]
},
{
"cell_type": "code",
"execution_count": 47,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABcIAAAPdCAYAAACp3hugAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8o6BhiAAAACXBIWXMAAA9hAAAPYQGoP6dpAAC6gUlEQVR4nOzdeZxe4/0//tedZTKJLEQWkd0uiC0NopYgaq0opdWK2El9lAiqtW+x02pttStKLaklDbGlSqho0NpKLKFJhCCRICQ5vz/8Ml9jEmaSieH2fD4e94P7Otc5532W+9yZ15y5TqkoiiIAAAAAAFCmGjV0AQAAAAAAsCQJwgEAAAAAKGuCcAAAAAAAypogHAAAAACAsiYIBwAAAACgrAnCAQAAAAAoa4JwAAAAAADKmiAcAAAAAICyJggHAAAAAKCsCcIBKDu/+93vUiqVsuaaazZ0Kd9I8+bNy3XXXZetttoq7dq1S9OmTdOhQ4fssMMOufPOOzNv3rwkyWuvvZZSqZSrr756idQxadKknHjiiXnqqaeWyPKvvvrqlEqlvPbaa0tk+bXxzDPPZO+9907Pnj1TWVmZli1bZr311stZZ52Vd999d4mu+6abbsoaa6yR5s2bp1QqVe3nCy+8MCuttFIqKipSKpXy/vvvZ/DgwenRo0ed17H55ptn8803r9e6v+i5557LiSeeuESO4/33358+ffpkqaWWSqlUyogRIxbY78vO1cGDB6dly5b1XtuScOKJJ6ZUKi3SvA899FBKpVIeeuih+i3qC76Oc2pJ+racD7W9vn/Z52/zzTf3PVvPSqVSTjzxxKr3X9fn7osW51rxTTC//nfeeaehSwHgG0YQDkDZufLKK5Mkzz77bB5//PEGruab5eOPP852222XvfbaKx06dMjFF1+cBx54IJdcckmWX375/PjHP86dd975tdQyadKknHTSSUssCN9+++0zduzYdOrUaYks/6v88Y9/zPrrr58nnngiRx55ZEaNGpXbb789P/7xj3PJJZdk3333XWLrfvvtt7PnnntmxRVXzKhRozJ27Nisssoqeeqpp3LooYemf//+eeCBBzJ27Ni0atUqxx13XG6//fY6r+eiiy7KRRddtAS24P957rnnctJJJ9V7EF4URXbbbbc0bdo0d9xxR8aOHZvNNttsgX2X9Ln6ddlvv/0yduzYRZp3vfXWy9ixY7PeeuvVc1V8ky2pzx+143MHAPWrSUMXAAD1ady4cXn66aez/fbb5+67784VV1yRDTbY4GutoSiKfPzxx2nevPnXut7aGDp0aO65555cc801GTRoULVpP/rRj3LkkUfmo48+aqDq6sdHH32UysrKtG/fPu3bt2+QGsaOHZuDDz44AwYMyIgRI9KsWbOqaQMGDMgRRxyRUaNGLbH1//e//82nn36an//859XC3WeffTZJsv/++6dv375V7SuuuOIiradXr16LV2gDmjRpUt59993svPPO2XLLLRu6nCXqww8/TIsWLdKlS5d06dJlkZbRunXrbLjhhvVcWcOYf434Nt/xyjffp59+mlKplCZNFv1H7nL63H1RfewfAKgrd4QDUFauuOKKJMkZZ5yRfv365c9//nM+/PDDJJ/90NWhQ4fsueeeNeZ7//3307x58wwdOrSqbcaMGRk2bFh69uyZioqKdO7cOYcddlhmzZpVbd5SqZRDDjkkl1xySVZfffU0a9Ys11xzTZLkpJNOygYbbJC2bdumdevWWW+99XLFFVekKIpqy5g9e3aOOOKILLfccmnRokU23XTTPPnkk+nRo0cGDx5cre+UKVNy4IEHpkuXLqmoqEjPnj1z0kknZc6cOV+6b6ZMmZLLL788P/jBD2qE4POtvPLK6d2790KXsbAhNBb0Z9R/+ctfssEGG6RNmzZp0aJFVlhhheyzzz5JPvtz7+9973tJkr333julUqnGn4SPGzcuP/zhD9O2bdtUVlZm3XXXzc0331xtHfOHP7n33nuzzz77pH379mnRokVmz569wKFR5v8p/xNPPJFNNtmkqq4zzjijakiY+Z599tlsvfXWadGiRdq3b59f/OIXufvuu2v1Z+qnn356SqVSLrvssmoh+HwVFRX54Q9/WPV+3rx5Oeuss7LaaqulWbNm6dChQwYNGpQ333yzxrz33Xdfttxyy7Ru3TotWrTIxhtvnPvvv79q+uDBg/P9738/SbL77runVCpVDTfx85//PEmywQYbpFQqVZ1bCzqu8+bNy4UXXph11lknzZs3z9JLL50NN9wwd9xxR7X9+cVhLD755JOceuqpVdvSvn377L333nn77ber9evRo0d22GGHjBo1Kuutt16aN2+e1VZbreovOpLPju+Pf/zjJEn//v2rzpOvGs7hH//4R7bccsu0atUqLVq0SL9+/XL33XdXTT/xxBOrAuGjjz46pVJpoUPD1OZcTZKXX3452223XVq2bJmuXbvmiCOOyOzZsxdp3yzMHXfckY022igtWrRIq1atMmDAgBp3eM//LP7rX//KrrvummWWWabqFx0L+pzW9tqzoCEa5g8DUpttr+21sLZqW/eXXSNefvnl7L333ll55ZXTokWLdO7cOTvuuGP+/e9/V1vX/G3/05/+lKFDh2a55ZZL8+bNs9lmm2X8+PELrK82+2RBbrrppmy99dbp1KlTmjdvntVXXz2/+tWvanzv1GXfT5o0KbvttltatWqVNm3aZPfdd8+UKVO+spbafv5qcz2t7ffpghRFkdNPPz3du3dPZWVl+vTpk9GjRy/w+lPX7+3rrrsuq6++elq0aJG11147d911V431v/TSS9ljjz3SoUOHNGvWLKuvvnr+8Ic/VOsz/xy57rrrcsQRR6Rz585p1qxZXn755bz99tsZMmRIevXqlZYtW6ZDhw7ZYost8vDDD3/ltn/xczd/SJuFvT7vq74r5rv77ruzzjrrpFmzZunZs2fOOeecr6xrvtoem/rYP/O3/ayzzsppp52Wbt26Va1zQduVJG+99VZ++tOfpk2bNunYsWP22WefTJ8+vdbbB0AZKgCgTHz44YdFmzZtiu9973tFURTF5ZdfXiQprr766qo+hx9+eNG8efNi+vTp1ea96KKLiiTFM888UxRFUcyaNatYZ511inbt2hXnnXdecd999xW//e1vizZt2hRbbLFFMW/evKp5kxSdO3cuevfuXdxwww3FAw88UPznP/8piqIoBg8eXFxxxRXF6NGji9GjRxennHJK0bx58+Kkk06qtv6f/vSnRaNGjYpf/epXxb333ltccMEFRdeuXYs2bdoUe+21V1W/yZMnF127di26d+9eXHrppcV9991XnHLKKUWzZs2KwYMHf+n+ueGGG4okxcUXX1yr/fnqq68WSYqrrrqqqm2vvfYqunfvXqPvCSecUHz+nxWPPvpoUSqVip/85CfFyJEjiwceeKC46qqrij333LMoiqKYPn16cdVVVxVJimOPPbYYO3ZsMXbs2OKNN94oiqIoHnjggaKioqLYZJNNiptuuqkYNWpUMXjw4Br1zF9G586diwMOOKD429/+Vtxyyy3FnDlzqqa9+uqrVf0322yzYtllly1WXnnl4pJLLilGjx5dDBkypEhSXHPNNVX9Jk2aVCy77LJFt27diquvvroYOXJkseeeexY9evQokhQPPvjgQvfbnDlzihYtWhQbbLBBrfZzURTFAQccUCQpDjnkkGLUqFHFJZdcUrRv377o2rVr8fbbb1f1u+6664pSqVQMHDiwuO2224o777yz2GGHHYrGjRsX9913X1EURfHyyy8Xf/jDH4okxemnn16MHTu2ePbZZ4tnn322OPbYY6v24dixY4uXX355ocd1zz33LEqlUrHffvsVf/3rX4u//e1vxWmnnVb89re/rbY/N9tss6r3c+fOLbbZZptiqaWWKk466aRi9OjRxeWXX1507ty56NWrV/Hhhx9W9e3evXvRpUuXolevXsW1115b3HPPPcWPf/zjIkkxZsyYoiiKYurUqcXpp59eJCn+8Ic/VJ0nU6dOXei+fOihh4qmTZsW66+/fnHTTTc
"text/plain": [
"<Figure size 1500x1000 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"fig, ax = plt.subplots(figsize=(15, 10))\n",
"index = np.arange(len(generalized_cc))\n",
"bar_width = 0.35\n",
"opacity = 0.8\n",
"\n",
"rects1 = plt.bar(index, analysis_results['Average Clustering Coefficient'], bar_width,\n",
"alpha=opacity,\n",
"color='b',\n",
"label='Standard Clustering')\n",
"\n",
"rects2 = plt.bar(index + bar_width, generalized_cc.values(), bar_width,\n",
"alpha=opacity,\n",
"color='g',\n",
"label='Generalized Clustering')\n",
"\n",
"plt.xlabel('Graph')\n",
"plt.ylabel('Average Clustering Coefficient')\n",
"plt.title('Average Clustering Coefficient of the original graph and the generalized graph')\n",
"plt.xticks(index + bar_width, generalized_cc.keys())\n",
"plt.legend()\n",
"\n",
"plt.tight_layout()\n",
"plt.show()"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"As evident, for the graphs derived from the checkins, the two values are nearly identical. On the other end, for the graphs derived from the friendships, the values differ significantly. This serves as further evidence that the checkins graphs exhibit a high likelihood of being a small-world network, compared to the friendships graphs.\n",
"\n",
"However, this alone is insufficient to arrive at a definitive conclusion."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## <a id='toc5_9_'></a>[Conclusions: the omega coefficient](#toc0_)\n",
"\n",
"We have already discussed a lot in the previous sections about this measure, let's see the results that we obtained after days of computations on the server:"
]
},
{
"cell_type": "code",
"execution_count": 48,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Graph</th>\n",
" <th>omega-coefficient</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Brightkite Checkins Graph</td>\n",
" <td>-0.25</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Gowalla Checkins Graph</td>\n",
" <td>-0.20</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Foursquare Checkins Graph</td>\n",
" <td>-0.17</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Brightkite Friendship Graph</td>\n",
" <td>-0.18</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Gowalla Friendship Graph</td>\n",
" <td>-0.24</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>Foursquare Friendship Graph</td>\n",
" <td>-0.05</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Graph omega-coefficient\n",
"0 Brightkite Checkins Graph -0.25\n",
"1 Gowalla Checkins Graph -0.20\n",
"2 Foursquare Checkins Graph -0.17\n",
"3 Brightkite Friendship Graph -0.18\n",
"4 Gowalla Friendship Graph -0.24\n",
"5 Foursquare Friendship Graph -0.05"
]
},
"execution_count": 48,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"analysis_results[['Graph', 'omega-coefficient']]"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"In order to illustrate the time-intensity of the Omega Coefficient computation, let's present the computation time for the networks generated from all networks. This results are obtained by running the `omega_sampled_server.py` function with `niter` and `nrand` equal to 3. Take into account that this is _not_ the parallelized version!\n",
"\n",
"<!-- create a table -->\n",
"\n",
"| Network | Time |\n",
"|:-------:|:----:|\n",
"| Brightkite Checkins | 9d 11h 25m |\n",
"| Gowalla Checkins | 3d 2h 55m |\n",
"| FourSquare Checkins | 6d 14h 13m |\n",
"| Brightkite Friendships | 17h 55m |\n",
"| Gowalla Friendships | 2h 22m |\n",
"| FourSquare Friendships | 2h 9m |\n",
"\n",
"It is noteworthy that, due to the compact size of the friendship graphs, I successfully calculated the Omega Coefficient for the entire networks. On the other hand, for the checkins graphs, I resorted to a 50% sample of the nodes. "
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"---\n",
"\n",
"The results of the Omega Coefficient computation are somewhat surprising. As stated previously the small-world coefficient (Omega) assesses the extent to which a network resembles a lattice or a random graph. Negative values indicate that the graph is similar to a lattice, while positive values suggest that the graph is more random-like. Values close to 0 should represent small-world characteristics.\n",
"\n",
"Based solely on this metric, one may infer that all the studied networks exhibit small-world characteristics. In fact, all the values of the omega coefficient are approximately $0.2$ (with the exception of the Foursquare Checkins graph, whose value is very close to 0). Nonetheless, this conclusion requires further scrutiny.\n",
"\n",
"As demonstrated in the preceding section, the Omega Coefficient can be misleading for networks with low clustering coefficients. In this case, the networks generated from friendships exhibit a low clustering coefficient and, as a result, bias the Omega Coefficient. This hypothesis of mine is reinforced by the results of other measures such as the Betweenness Centrality and the Clustering Coefficient, which suggest that the networks generated from friendships are not small-world networks.\n",
"\n",
"Moreover, the graphs represent a social network in 2010, a time when social networks were not as prevalent as they are today. Hence, it is plausible that these networks are not small-worlds. I would have no problems believing that it's more likely to have visited the same place of a random person on the network, rather then being friends with them. This meaning that, heuristically, the networks generated from checkins are more likely to be small-worlds.\n",
"\n",
"From a technical standpoint, using `niter` and `nrand` equal to 3 is insufficient to reach a definitive conclusion. However, increasing the values would have significantly prolonged the computation time of the Omega Coefficient and reducing the number of nodes in the sample would have reduced the accuracy of the results. So unfortunately, due to the time constraints, I was unable to test this hypothesis.\n",
"\n",
"\n",
"---\n",
"\n",
"This study highlights the challenges in characterizing the small-world property of real-world networks. Despite utilizing established techniques, the results may still be inconclusive. In such cases, it is necessary to examine the specific properties of individual networks. This is exemplified by the Omega Coefficient, which can be influenced by unique characteristics of real-world networks, rendering the general results unreliable. In contrast, the results obtained from random networks are more predictable and reliable, as they do follow strict mathematical rules and have no unique characteristics determined by the real-world."
]
2 years ago
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# <a id='toc6_'></a>[References](#toc0_)\n",
2 years ago
"\n",
"> _In no particular order_\n",
"\n",
"`[1]` On the evolution of random graphs, P. Erdős, A. Rényi, _Publ. Math. Inst. Hungar. Acad. Sci._, 5, 17-61 (1960).\n",
"\n",
"`[2]` Complex Networks: Structure, Robustness, and Function, R. Cohen, S. Havlin, D. ben-Avraham, H. E. Stanley, _Cambridge University Press, 2009_.\n",
"\n",
"`[3]` Collective dynamics of 'small-world' networks, D. J. Watts and S. H. Strogatz, _Nature_, 393, 440-442, 1998.\n",
"\n",
"`[4]` On random graphs I, P. Erdős and A. Rényi, _Publ. Math. Inst. Hungar. Acad. Sci._, 5, 290-297, 1960.\n",
"\n",
"`[5]` Generalizations of the clustering coefficient to weighted complex networks, M. E. J. Newman, _Physical Review E_, 74, 036104, 2006.\n",
"\n",
"`[6]` The ubiquity of small-world networks. Telesford QK, Joyce KE, Hayasaka S, Burdette JH, Laurienti PJ. _Brain Connect_. 2011;1(5):367-75\n",
"\n",
"`[8]` Humphries and Gurney (2008). “Network Small-World-Ness: A Quantitative Method for Determining Canonical Network Equivalence”. PLoS One. 3 (4)\n",
"\n",
"`[9]` The brainstem reticular formation is a small-world, not scale-free, network M. D. Humphries, K. Gurney and T. J. Prescott, Proc. Roy. Soc. B 2006 273, 503-511,\n",
"\n",
"`[10]` Sporns, Olaf, and Jonathan D. Zwi. “The small world of the cerebral cortex.” Neuroinformatics 2.2 (2004): 145-162.\n",
"\n",
"`[11]` Maslov, Sergei, and Kim Sneppen. “Specificity and stability in topology of protein networks.” Science 296.5569 (2002): 910-913.\n",
"\n",
"`[13]` B. Bollob ́as, Random Graphs, 1985. London: Academic Press\n",
"\n",
"`[14]` R. Cohen, K. Erez, D. ben-Avraham, and S. Havlin, Resilience of the Internet to\n",
"random breakdown, Physical Review Letters 85 (2000), 46264628 \n",
"\n",
"`[15]` Dingqi Yang, Bingqing Qu, Jie Yang, Philippe Cudre-Mauroux, Revisiting User Mobility and Social Relationships in LBSNs: A Hypergraph Embedding Approach, In Proc. of The Web Conference (WWW'19). May. 2019, San Francisco, USA.\n",
"\n",
"`[16]` Ulrik Brandes, A Faster Algorithm for Betweenness Centrality, Journal of Mathematical Sociology, 25(2):163-177, 2001._\n",
"\n",
"`[17]` Error and attack tolerance of complex networks, R. Albert, Nature volume 406, pages378382 (2000) \n",
"\n",
"<!-- `[18]` Boldi, Paolo, and Sebastiano Vigna. \"Axioms for Centrality.\" ArXiv, (2013). -->\n",
2 years ago
"\n",
"\n"
]
}
],
"metadata": {
"kernelspec": {
2 years ago
"display_name": "Python 3.10.8 64-bit",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.9"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
2 years ago
"hash": "e7370f93d1d0cde622a1f8e1c04877d8463912d04d973331ad4851f04de6915a"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}