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.

17207 lines
4.4 MiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"%load_ext autoreload\n",
"%autoreload 2\n",
"\n",
"import os\n",
"import wget\n",
"import zipfile\n",
"import numpy as np\n",
"import pandas as pd\n",
"import networkx as nx\n",
"import plotly.graph_objects as go\n",
"from utils import *\n",
"from collections import Counter\n",
"from tqdm import tqdm\n",
"import time\n",
"import geopandas as gpd\n",
"import multiprocessing\n",
"\n",
"# ignore warnings\n",
"import warnings\n",
"warnings.filterwarnings(\"ignore\")"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# Introduction\n",
"\n",
"## Graph Theory and notations\n",
"\n",
"SCRIVERE\n",
"\n",
"## Aim of the project\n",
"\n",
"SCRIVERE\n",
"\n",
"<!-- Given a social network, which of its nodes are more central? 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",
"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 \\cite{closeness}, 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$. -->"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# Random Networks: The Erdős-Rényi model\n",
"\n",
"<!-- Before 1960, graph theory mainly dealt with the properties of specific individual graphs. In the 1960s, Paul Erdős and Alfred Rényi initiated a systematic study of random graphs. Random graph theory is, in fact, not the study of individual graphs, but the study of a statistical ensemble of graphs (or, as mathematicians prefer to call it, a probability space of graphs). The ensemble is a class consisting of many different graphs, where each graph has a probability attached to it. A property studied is said to exist with probability $P$ if the total probability of a graph in the ensemble possessing that property is $P$ (or the total fraction of graphs in the ensemble that has this property is $P$). This approach allows the use of probability theory in conjunction with discrete mathematics for studying graph ensembles. A property is said to exist for a class of graphs if the fraction of graphs in the ensemble which does not have this property is of zero measure. This is usually termed as a property of \\emph{almost every (a.e.)} graph. Sometimes the terms “almost surely” or “with high probability” are also used (with the former usually taken to mean that the residual probability vanishes exponentially with the system size). -->\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 studying random graphs, which involves analyzing a collection, or ensemble, of many different graphs. 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. \n",
"\n",
"## Definition of a random graph\n",
"\n",
"Let $E_{n,N}$ denote the set of alla graphs having $n$ given labelled vertices $V_1,V_2, \\dots, V_n$ and $N$ edges. The graphs considered are supposed to be not oriented, without parallel edges and without slings. Thus a graph belonging to $E_{n,N}$ is obtained by choosing $N$ out of the $\\binom{n}{2}$ possible edges between the points $V_1,V_2, \\dots, V_n$, and therefore the number of elements of $E_{n,N}$ is given by the binomial coefficient $\\binom{\\binom{n}{2}}{N}$. \n",
"\n",
"A random graph $\\Gamma_{n,N}$ can be defined as a element of $E_{n,N}$ chosen at random, so that each of the elements of $E_{n,N}$ has the same probability of being chosen, namely $\\frac{1}{\\binom{\\binom{n}{2}}{N}}$.\n",
"\n",
"Let's try to modify this point of view and use a bit of probability theory. _We may consider the formation of a random graph as a stochastic process_ defined as follows: At time $t=1$ we choose out of the $\\binom{n}{2}$ possible edges between the points $V_1,V_2, \\dots, V_n$ $N$ edges, each of this edges having the same probability of being chosen; let this edge be denoted as $e_1$. At time $t=2$ we choose one of the possible $\\binom{n}{2} -1$, different from $e_1$, all this being equiprobable. Continuing this process at time $t=k+1$ we choose one of the possible $\\binom{n}{2} -k$, different from $e_1, e_2, \\dots, e_k$, all this being equiprobable, i.e having the probability $\\frac{1}{\\binom{n}{2} -k}$. We denote $\\Gamma_{n,N}$ the graph obtained by choosing $N$ edges in this way.\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.\n",
"\n",
"\n",
"**SOURCES:** \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",
"## Erdős-Rényi graphs\n",
"\n",
"<!-- Two well-studied graph ensembles are $G_{N,M}$, the ensemble of all graphs with $N$ nodes and $M$ edges, and $G_{N,p}$, the ensemble of all graphs with $N$ nodes and probability $p$ of any two nodes being connected. These two families, initially studied by Erdős and Rényi, are known to be similar if $M = \\binom{N}{2} p$, so as long $p$ is not too close to $0$ or $1$ they are referred to as ER graphs. \n",
"\n",
"An important attribute of a graph is the average degree, i.e., the average number of edges connected to each node. We will denote the degree of the ith node by $k_i$ and the average degree by $ \\langle r \\rangle $ . $N$-vertex graphs with $\\langle k \\rangle = O(N^0)$ are called sparse graphs. \n",
"\n",
"An interesting characteristic of the ensemble $G_{N,p}$ is that many of its properties have a related threshold function, $p_t(N)$, such that the property exists, in the “thermodynamic limit” of $N \\to \\infty$ with probability 0 if $p < p_t$ , and with probability $1$ if $p > p_t$ . This phenomenon is the same as the physical concept of a percolation phase transition. \n",
"\n",
"Another property is the average path length between any two nodes, which in almost every graph of the ensemble (with $\\langle k \\rangle > 1$ and finite) is of order $\\ln N$ . The small, logarithmic distance is actually the origin of the “small-world” phenomena that characterize networks. -->\n",
"\n",
"There are two well-known ensembles of graphs that have been extensively studied: the ensemble of all graphs with $N$ nodes and $M$ edges, denoted $G_{N,M}$, and the ensemble of all graphs with $N$ nodes and a probability $p$ of any two nodes being connected, denoted $G_{N,p}$. These ensembles, initially studied by Erdős and Rényi, are similar when $M = \\binom{N}{2} p$, and are therefore referred to as ER graphs when $p$ is not too close to 0 or 1.\n",
"\n",
"An important feature of a graph is its average degree, or the average number of edges connected to each node. We will denote the degree of the $i$-th node by $k_i$ and the average degree by $\\langle r \\rangle$. Graphs with $N$ nodes and $\\langle k \\rangle = O(N^0)$ are called sparse graphs.\n",
"\n",
"One interesting property of the ensemble $G_{N,p}$ is that many of its characteristics have a corresponding threshold function, $p_t(N)$, such that the property exists 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",
"Another property of interest is the average path length between any two nodes, which is typically of order $\\ln N$ in almost every graph of the ensemble (with $\\langle k \\rangle > 1$ and finite). This small, logarithmic distance is the source of the \"small-world\" phenomena that are characteristic of networks.\n",
"\n",
"**SOURCE:**\n",
"- `[i]` Complex Networks: Structure, Robustness, and Function, R. Cohen, S. Havlin, D. ben-Avraham, H. E. Stanley, _Cambridge University Press, 2009_.\n",
"\n",
"\n",
"## Scale-free networks\n",
"\n",
"<!-- The Erdős-Rényi model has traditionally been the dominant subject of study in the field of random graphs. Recently, however, several studies of real-world networks have found that the ER model fails to reproduce many of their observed properties. One of the simplest properties of a network that can be measured directly is the degree distribution, or the fraction P(k) of nodes having k connections (degree $k$). A well-known result for ER networks is that the degree distribution is Poissonian,\n",
"\n",
"\\begin{equation}\n",
" P(k) = \\frac{e^{z} z^k}{k!}\n",
"\\end{equation}\n",
"\n",
"Where $z = \\langle k \\rangle$. is the average degree. Direct measurements of the degree distribution for real networks show that the Poisson law does not apply. Rather, often these nets exhibit a scale-free degree distribution:\n",
"\n",
"\\begin{equation}\n",
" P(k) = ck^{-\\gamma} \\quad \\text{for} \\quad k = m, ... , K\n",
"\\end{equation}\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 then $\\lceil \\gamma -1 \\rceil$ (as $K \\to \\infty$ when $N \\to \\infty$) is responsible for many of the anomalous properties attributed to scale-free networks. \n",
"\n",
"All real-world networks are finite and therefore all their moments are finite. The actual value of the cutoff K plays an important role. It may be approximated by noting that the total probability of nodes with $k > K$ is of order $1/N$\n",
"\n",
"\\begin{equation}\n",
" \\int_K^\\infty P(k) dk \\sim \\frac{1}{N}\n",
"\\end{equation}\n",
"\n",
"This yields the result\n",
"\n",
"\\begin{equation}\n",
" K \\sim m N^{1/(\\gamma -1)}\n",
"\\end{equation}\n",
"\n",
"The degree distribution alone is not enough to characterize the network. There are many other quantities, such as the degree-degree correlation (between connected nodes), the spatial correlations, the clustering coefficient, the betweenness or central-ity distribution, and the self-similarity exponents. -->\n",
"\n",
"The Erdős-Rényi model 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 for ER networks is that the degree distribution follows a Poisson distribution, given by\n",
"\n",
"\\begin{equation}\n",
"P(k) = \\frac{e^{z} z^k}{k!}\n",
"\\end{equation}\n",
"\n",
"where $z = \\langle k \\rangle$ is the average degree. 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",
"\\begin{equation}\n",
"P(k) = ck^{-\\gamma} \\quad \\text{for} \\quad k = m, ... , K\n",
"\\end{equation}\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",
"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$, or\n",
"\n",
"\\begin{equation}\n",
"\\int_K^\\infty P(k) dk \\sim \\frac{1}{N}\n",
"\\end{equation}\n",
"\n",
"This gives the result\n",
"\n",
"\\begin{equation}\n",
"K \\sim m N^{1/(\\gamma -1)}\n",
"\\end{equation}\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.\n",
"\n",
"- `[i]` Complex Networks: Structure, Robustness, and Function, R. Cohen, S. Havlin, D. ben-Avraham, H. E. Stanley, _Cambridge University Press, 2009_.\n",
"\n",
"# Diameter and fractal dimension\n",
"\n",
"<!-- Regular lattices can be viewed as networks embedded in Euclidean space, of a well-defined dimension, $d$. This means 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, $d$ in the last relation may be a non-integer and is replaced by the fractal dimension $d_f$ \n",
"\n",
"An example of a network where the above power laws are not valid is the Cayley tree (also known as the Bethe lattice). The Cayley tree is a regular graph, of fixed degree $z$, and no loops. An infinite Cayley tree cannot be embedded in a Euclidean space of finite dimensionality. The number of nodes at $l$ is $n(l) \\sim (z - 1)^l$ . Since the exponential growth is faster than any power law, Cayley trees are referred to as infinite-dimensional systems. \n",
"\n",
"In most random network models, the structure is locally tree-like (since most loops occur only for $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 consequence, the diameter of such graphs (i.e., the minimal path between the most distant nodes) scales as $D \\sim \\ln N$. Many properties of ER networks, including the logarithmic diameter, are also present in Cayley trees. This small diameter in ER graphs and Cayley trees is in contrast to that of finite-dimensional lattices, where $D \\sim N^{1/d_l}$. \n",
"\n",
"Similar to ER, percolation on infinite-dimensional lattices and the Cayley tree yields a critical threshold $p_c = 1/(z - 1)$. For $p > p_c$, a “giant cluster” of order $N$ exists, whereas for $p < pc$,only small clusters appear. For infinite-dimensional lattices (similar to ER networks) at criticality, $p = p_c$ , the giant component is of size $N^{2/3}$. This last 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$, and therefore the size of the giant cluster scales as $N^{d_f/d_c} = N^{2/3}$. The dimension $d_c$ is called the “upper critical dimension.” Such an upper critical dimension exists not only in percolation phenomena, but also in other physical models, such as in the self-avoiding walk model for polymers and in the Ising model for magnetism; in both these cases $d_c = 4$.\n",
"\n",
"Watts and Strogatz suggested a model that retains the local high clustering of lattices (i.e., the neighbors of a node have a much higher probability of being neighbors than in random graphs) while reducing the diameter to $D \\sim \\ln N$ . This so-called, “small-world network” is achieved by replacing a fraction $\\varphi$ of the links in a regular lattice with random links, to random distant neighbors. -->\n",
"\n",
"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$.\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",
"![](https://i.imgur.com/VLxR3AL.png)\n",
"\n",
"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$. 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$.\n",
"\n",
"- `[i]` Complex Networks: Structure, Robustness, and Function, R. Cohen, S. Havlin, D. ben-Avraham, H. E. Stanley, _Cambridge University Press, 2009_.\n",
"\n",
"### Watts-Strogatz model\n",
"\n",
"In 1998 Watts and Strogatz proposed a model that retains the high local clustering of lattices (i.e., the neighbors of a node have a higher probability of being neighbors than in random graphs) while reducing the diameter to $D \\sim \\ln N$. This so-called \"small-world network\" is achieved by replacing a fraction $\\varphi$ of the links in a regular lattice with random links to random, distant neighbors. The model then proceeds as follows: for each edge, the probability $p$ of rewiring it is considered. If the edge is rewired, it is replaced by a random edge with uniform probability. The resulting network is a small-world network with $N$ nodes, $k$ nearest neighbors, and average distance $\\log(N)/\\log(k)$. \n",
"\n",
"More details et al. can be found in the following paper:\n",
"\n",
"- `[i]` Collective dynamics of 'small-world' networks, D. J. Watts and S. H. Strogatz, _Nature_, 393, 440-442, 1998.\n",
"\n",
"\n",
"\n",
"## Random graphs as a model of real networks\n",
"\n",
"<!-- Many natural and man-made systems are networks, i.e., they consist of objects and interactions between them. These include computer networks, in particular the Internet, logical networks, such as links between WWW pages, and email networks, where a link represents the presence of a person's address in another person's address book. Social interactions in populations, work relations, etc. can also be modeled by a network structure. Networks can also describe possible actions or movements of a system in a configuration space (a phase space), and the nearest configurations are connected by a link. All the above examples and many others have a graph structure that can be studied. Many of them have some ordered structure, derived from geographical or geometrical considerations, cluster and group formation, or other specific properties. However, most of the above networks are far from regular lattices and are much more complex and random in structure. Therefore, it can be assumed (with a lot of precaution) that they maintain many properties of the appropriate random graph model. \n",
"\n",
"In many aspects scale-free networks can be regarded as a generalization of ER networks. For large $\\gamma$ (usually, for $\\gamma > 4$) the properties of scale-free networks, such as distances, optimal paths, and percolation, are the same as in ER networks. In contrast, for $\\gamma < 4$, these properties are very different and can be regarded as anomalous. The anomalous behavior of scale-free networks is due to the strong heterogeneity in the degree of the nodes, which breaks the node-to-node translational homogeneity (symmetry) that exists in the classical\n",
"homogeneous networks, such as lattices, Cayley trees, and ER graphs. The small variation of the degrees in the ER model or in scale-free networks with large $gamma$ is insufficient to break this symmetry, and therefore many results for ER networks are the same as for Cayley trees, where the degree of each node is the same. -->\n",
"\n",
"Many natural and man-made systems can be represented as networks, consisting of objects and interactions between them. Examples include computer networks, particularly the Internet, logical networks such as links between web pages and email networks, where a link represents the presence of an individual's address in another person's address book, and social interactions in populations or work relations. Networks can also describe possible actions or movements of a system in a configuration space (a phase space), with nearest configurations connected by a link. All of these examples and many others have a graph structure that can be studied. Many of these networks have some ordered structure, derived from geographical or geometrical considerations, cluster and group formation, or other specific properties, but most of them are far from regular lattices and are much more complex and random in structure. Therefore, it is often assumed (with caution) that they share many properties with the appropriate random graph model.\n",
"\n",
"In many ways, scale-free networks can be considered a generalization of ER networks. For large $\\gamma$ (typically $\\gamma > 4$), the properties of scale-free networks such as distances, optimal paths, and percolation are the same as in ER networks. In contrast, for $\\gamma < 4$, these properties are very different and can be considered anomalous. The anomalous behavior of scale-free networks is due to the strong heterogeneity in the degrees of the nodes, which breaks the node-to-node translational homogeneity (symmetry) present in\n",
"\n",
"---"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"Now let's move to a more technical part of the notebook, where we will try to analyze those properties of the networks that we have just discussed on real-world networks. We will try to use as much as possible the `networkx` library, which is a Python package for the creation, manipulation, and study of the structure, dynamics, and functions of complex networks. However, there were some scenarios were it was necessary to manually implement some of the algorithms, so please refer to the `utils.py` file for more details.\n",
"\n",
"All the computations have been run and tested on a Arch Linux machine with an AMD Ryzen 5 2600 (6 cores, 12 threads) and 16 GB of RAM. The code has been written in Python 3.10.9; to install the required packages, please run the following command:\n",
"\n",
"```bash\n",
"pip3 install -r requirements.txt\n",
"```\n",
"\n",
"I tried to make the code as wide-compatible as possible, but I have no way to test it on a Windows machine. So if you encounter any problems, please, install Linux _(joking, joking)_.\n",
"\n",
"# Discovering the datasets"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"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",
"If any of the datasets is already downloaded, it will not be downloaded again. 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 while to download the datasets. It's gonna take about 3 minutes to download all the datasets.\n",
"\n",
"---\n",
"\n",
"### A deeper look at the datasets\n",
"\n"
]
},
{
"cell_type": "code",
"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",
"100%|██████████| 2.68G/2.68G [02:04<00:00, 21.5MB/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",
"Archive: data/foursquare/foursquare_full.zip\n",
" creating: data/foursquare/dataset_WWW2019/\n",
" inflating: data/foursquare/dataset_WWW2019/raw_Checkins_anonymized.txt \n",
" inflating: data/foursquare/dataset_WWW2019/.DS_Store \n",
" creating: data/foursquare/__MACOSX/\n",
" creating: data/foursquare/__MACOSX/dataset_WWW2019/\n",
" inflating: data/foursquare/__MACOSX/dataset_WWW2019/._.DS_Store \n",
" inflating: data/foursquare/dataset_WWW2019/raw_POIs.txt \n",
" inflating: data/foursquare/dataset_WWW2019/dataset_WWW_friendship_old.txt \n",
" inflating: data/foursquare/dataset_WWW2019/dataset_WWW_readme.txt \n",
" inflating: data/foursquare/__MACOSX/dataset_WWW2019/._dataset_WWW_readme.txt \n",
" inflating: data/foursquare/dataset_WWW2019/dataset_WWW_Checkins_anonymized.txt \n",
" inflating: 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 minutes to download and extract the datasets with a fiber connection"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's have a deeper look at them.\n",
"\n",
"## Brightkite\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",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Number of unique users: 35538\n"
]
},
{
"data": {
"text/plain": [
"<AxesSubplot: >"
]
},
"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')\n",
"\n",
"# take only the dates 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",
"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",
"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'))"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Gowalla\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",
"\n",
"Let's have a more clear view of where our data have been generated"
]
},
{
"cell_type": "code",
"execution_count": 3,
"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 the dates 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, to help us in the next sections, let's take a subset of the European area"
]
},
{
"cell_type": "code",
"execution_count": 4,
"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",
"execution_count": 5,
"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'))"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Foursquare\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). 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",
"This dataset is by far the biggest of the 3 that we got. The check-in dataset contains 22,809,624 checkins by 114,324 users on 3,820,891 venues. The social network data contains 607,333 friendships. As explained before, we are going to need sub-samples! In this case, we'll take only data from 2012 that have been generated in Italy. Due to the size of the full network, this time we won't plot it, otherwise our RAM might cry and our beloved kernel will be forced to kill our process."
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Starting to plot\n",
"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 the 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",
"print(\"Starting to plot\")\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",
"execution_count": 7,
"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": [
"# Building the networks"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"We are going to build the the networks for the three datasets as an undirected graph $M = (V, E)$, where $V$ is the set of nodes and $E$ is the set of edges. The nodes represent the users and the edges indicates that two individuals visited the same location at least once.\n",
"\n",
"The check-ins files of the three datasets are not in the form of a graph edge list, so we need to manipulate them. Let's have a look at the number of lines of each file."
]
},
{
"cell_type": "code",
"execution_count": 8,
"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 would like to build a graph starting from an edge list. To do that, we are going to check, for each venue, all the users that visited it. Then, we will create an edge between each pair of users that visited the same venue (avoiding repetitions). This can be easily done in python, but it's going to be a bit slow (this is why we are considering sub-samples of the datasets). Let's see how to do it.\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",
"It the `utilis.py` module, we have a function that does exactly this called `create_graph_from_checkins`. It takes as input the name of the dataset and returns a networkx graph object. By default it will also write the edge list to a file in the respective dataset folder. The options are\n",
"\n",
"- `brightkite`\n",
"- `gowalla`\n",
"- `foursquare`\n",
"\n",
"Let's see how it works:"
]
},
{
"cell_type": "code",
"execution_count": 9,
"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, 310654.33it/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, 325535.48it/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, 145251.93it/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')\n",
"G_brighkite_checkins.name = 'Brightkite Checkins Graph'\n",
"\n",
"G_gowalla_checkins = create_graph_from_checkins('gowalla')\n",
"G_gowalla_checkins.name = 'Gowalla Checkins Graph'\n",
"\n",
"G_foursquare_checkins = create_graph_from_checkins('foursquare')\n",
"G_foursquare_checkins.name = 'Foursquare Checkins Graph'"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"### Friendship network\n",
"\n",
"Now we want to create a graph where two users are connected if they are friends in the social network. We are intending the concept of friendship in a \"facebook way\", not a \"twitter way\". Less empirically, the graphs is not going to be directed and the edges are not going to be weighted. A user can't be friend with himself, and can't be friend with a user without the user being friend with him.\n",
"\n",
"Since we filtered the checkins for foursquare and gowalla, we are considering only the users that are also present in the check-ins graph. We can build this graph with the function `create_friendships_graph` in the `utils.py` module. It takes as input the name of the dataset and returns a networkx graph object. By default it will also write the edge list to a file in the respective dataset folder. The options are\n",
"\n",
"- `brightkite`\n",
"- `gowalla`\n",
"- `foursquare`\n",
"\n",
"> **NOTE:** This functions is implemented without the necessity of the checkins graphs being loaded in memory, it uses the edge list file. This choice was made since someone may want to perform some analysis only on the friendship network and so there is no need to load the checkins graph and waste memory. Furthermore, networkx is tremendously slow when loading a graph from an edge list file.\n",
"\n",
"Let's see how it works:"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Computation done for Brightkite friendship graph\n",
"Computation done for Gowalla friendship graph\n",
"Computation done for Foursquare friendship graph\n"
]
}
],
"source": [
"G_brighkite_friends = create_friendships_graph('brightkite')\n",
"print(\"Computation done for Brightkite friendship graph\")\n",
"G_brighkite_friends.name = 'Brightkite Friendship Graph'\n",
"\n",
"\n",
"G_gowalla_friends = create_friendships_graph('gowalla')\n",
"print(\"Computation done for Gowalla friendship graph\")\n",
"G_gowalla_friends.name = 'Gowalla Friendship Graph'\n",
"\n",
"\n",
"G_foursquare_friends = create_friendships_graph('foursquare')\n",
"print(\"Computation done for Foursquare friendship graph\")\n",
"G_foursquare_friends.name = 'Foursquare Friendship Graph'"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"Now that we have our graphs, let's have a look at some basic information about them"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Brightkite Friendship Graph\n",
"Number of nodes: 5420\n",
"Number of edges: 14690\n",
"\n",
"Gowalla Friendship Graph\n",
"Number of nodes: 2294\n",
"Number of edges: 5548\n",
"\n",
"Foursquare Friendship Graph\n",
"Number of nodes: 1397\n",
"Number of edges: 5323\n",
"\n"
]
}
],
"source": [
"for G in [G_brighkite_friends, G_gowalla_friends, G_foursquare_friends]:\n",
" print(G.name)\n",
" print('Number of nodes: ', G.number_of_nodes())\n",
" print('Number of edges: ', G.number_of_edges())\n",
" print()"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"This networks are more abstract then the one observed before, there is no geographical information. We can try to plot them introducing a gravity (in the Newtonian sense) model and see how to the nodes interacts between them. Since the plot will be displayed on a web page as an html file, we need to sample them a lot. This won't give us a precise representation of the network, but it will give us a general idea of how the nodes are distributed. We are going to take a subsample of about 1000 nodes, considering only the largest connected component. \n",
"\n",
"We can do that with function `visualize_graphs` in the `utils.py` module. It takes as input a netowrkx graph object, a `k` percentage of nodes to remove and a `connected` boolean that indicates if we want to consider only the largest connected component. By default `k` is set to take a subsample of about 1000 nodes and `connected` is set to `True`. It returns a .html file that can be opened in a browser. All the files will be downloaded in the `html_graphs` folder."
]
},
{
"cell_type": "code",
"execution_count": 13,
"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\n",
"\n",
"# checkins_graph = [G_brighkite_checkins, G_gowalla_checkins, G_foursquare_checkins]\n",
"# for graph in checkins_graph:\n",
"# visualize_graphs(graph, k = None, connected=True)"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"Then we can open the file in a browser and see the result. On a unix environment, if there is firefox installed, we can do that with 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."
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# Properties of the networks\n",
"\n",
"To help us visualize the results of our analysis we can create a dataframe and fill it with all the information that we will retrive from our networks in this section.\n",
"\n",
"As we'll see in the cells below, the full networks are very big, even after the filtering that we did. This leads to long run times for the functions that we are going to use. To avoid this, we are going to use a sub-sample of the networks. Consider that depending on how much we want to sample, our results will be more or less accurate. \n",
"\n",
"What I suggest to do while reviewing this notebook is to use higher values for the sampling rate, so that you can see the results faster. This will give you a general idea of how the implemented functions work. Then, at the end of this section I have provided a link from my GitHub repository where you can download the results obtained with very low sampling rates. In this way you can test the functions with mock-networks and see if they work as expected, then we can proceed with the analysis using the more accurate results that required more time to compute."
]
},
{
"cell_type": "code",
"execution_count": 14,
"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": 15,
"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>1170</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>2300</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 1170 NaN \n",
"4 Gowalla Friendship Graph 1500 2300 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": 15,
"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"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Average Degree\n",
"\n",
"The degree of a node is the number of links connected to it. The average degree alone, is not very useful for our future analysis, so we won't spend much time about it. In the next section we will see that the degree distribution is a much more useful measure.\n",
"\n",
"The degree distribution, $P(k)$, is the fraction of sites having degree $k$. We know from the literature that many real networks do not exhibit a Poisson degree distribution, as predicted in the ER model. In fact, many of them exhibit a distribution with a long, power-law, tail, $P(k) \\sim k^{-\\gamma}$ with some $γ$, usually between $2$ and $3$.\n",
"\n",
2 years ago
"For know, we will just compute the average degree of our networks and add it to the dataframe."
]
},
{
"cell_type": "code",
"execution_count": 16,
"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.56</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Gowalla Friendship Graph</td>\n",
" <td>3.066667</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.56\n",
"4 Gowalla Friendship Graph 3.066667\n",
"5 Foursquare Friendship Graph 7.620616"
]
},
"execution_count": 16,
"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']]"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Clustering coefficient\n",
"\n",
"The clustering coefficient is usually related to a community represented by local structures. The usual definition of clustering is related to the number of triangles in the network. The clustering is high if two nodes sharing a neighbor have a high probability of being connected to each other. There are two common definitions of clustering. The first is global,\n",
"\n",
"$$ C = \\frac{3 \\times \\text{the number of triangles in the network}}{\\text{the number of connected triples of vertices}}$$\n",
"\n",
"where a “connected triple” means a single vertex with edges running to an unordered\n",
"pair of other vertices. \n",
"\n",
"A second definition of clustering is based on the average of the clustering for single nodes. The clustering for a single node is the fraction of pairs of its linked neighbors out of the total number of pairs of its neighbors:\n",
"\n",
"\\begin{equation}\n",
" C_i = \\frac{\\text{the number of triangles connected to vertex }i}{\\text{the number of triples centered on vertex } i}\n",
"\\end{equation}\n",
"\n",
"For vertices with degree $0$ or $1$, for which both numerator and denominator are zero, we use $C_i = 0$. Then the clustering coefficient for the whole network is the average\n",
"\n",
"\\begin{equation}\n",
" C = \\frac{1}{n} \\sum_{i} C_i\n",
"\\end{equation}\n",
"\n",
"In both cases the clustering is in the range $0 \\leq C \\leq 1$. \n",
"\n",
"In random graph models such as the ER model and the configuration model, the clustering coefficient is low and decreases to $0$ as the system size increases. This is also the situation in many growing network models. However, in many real-world networks the clustering coefficient is rather high and remains constant for large network sizes. \n",
"\n",
"> This observation led to the introduction of the small-world model, which offers a combination of a regular lattice with high clustering and a random graph. \n",
"\n",
"---\n",
"\n",
"The library `networkx` provides a function to compute the clustering coefficient of a graph. In particular, the function `average_clustering` computes the average clustering coefficient of a graph. \n",
"\n",
"<!-- Unfortunately, since our dataset (even after sub-sampling) are too big to be processed exactly in decent times.\n",
"\n",
"We can use the `average_clustering` function from the `utils` module to compute the average clustering coefficient on a random sub-sample of the graph. The functions takes as input:\n",
"\n",
"- `G: networkx graph object`: the graph on which we want to compute the average clustering coefficient\n",
"- `k: int (default=None)`: percentage of nodes to remove from the graph. If k is None, the average clustering coefficient of each connected component is computed using all the nodes of the connected component.\n",
"\n",
"And returns:\n",
"\n",
"- `float`: the average clustering coefficient of the graph\n",
"\n",
"Depending on the machine and the time available, we can choose different values for `k`. Lower values will give us a more precise result, but will take longer to compute. On the other hand, higher values will give us a less precise result, but will be faster to compute. I suggest to use `k=0.9` to test very quickly the function, and at least `k=0.6` to get a more precise result.\n",
"\n",
"> Since the checkins graphs are way bigger then the friendship graphs, I created two for loop to compute the average clustering coefficient with different values of `k`. -->"
]
},
{
"cell_type": "code",
"execution_count": 17,
"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: 14.0 seconds\n",
"\n",
"Computing average clustering coefficient for the Gowalla Checkins Graph...\n",
"\tAverage clustering coefficient: 0.5483724940778376\n",
"\tCPU time: 1.6 seconds\n",
"\n",
"Computing average clustering coefficient for the Foursquare Checkins Graph...\n",
"\tAverage clustering coefficient: 0.6527297407924693\n",
"\tCPU time: 18.1 seconds\n",
"\n",
"Computing average clustering coefficient for the Brightkite Friendship Graph...\n",
"\tAverage clustering coefficient: 0.07467551661322992\n",
"\tCPU time: 0.0 seconds\n",
"\n",
"Computing average clustering coefficient for the Gowalla Friendship Graph...\n",
"\tAverage clustering coefficient: 0.16751554817943182\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.074676</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Gowalla Friendship Graph</td>\n",
" <td>0.167516</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.074676\n",
"4 Gowalla Friendship Graph 0.167516\n",
"5 Foursquare Friendship Graph 0.183485"
]
},
"execution_count": 17,
"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']]"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Average Path Length\n",
"\n",
"Since we are considering our networks as _not_ embedded in real space (even if we could theoretically), the geometrical distance between nodes is meaningless. The most important distance measure in such networks is the minimal number of hops (or chemical distance). That is, the distance between two nodes in the network is defined as the number of edges in the shortest path between them. \n",
"\n",
"--- \n",
"\n",
"The `networkx` library provides a function to compute the average shortest path length of a graph. In particular, the function `average_shortest_path_length` computes the average shortest path length of a graph. Unfortunately, as always, there are some limitations. The function can only be applied to connected graphs and since we are taking sub-samples of our datasets, there is a probability that the sub-sample is not connected. Another problem is that this operation is very expensive! The shortest path length is defined as\n",
"\n",
"$$ a = \\sum_{s \\in V} \\sum_{t \\in V} \\frac{d(s,t)}{n(n-1)} $$\n",
"\n",
"Where $V$ is the set of nodes in the graph, $n$ is the number of nodes in the graph, and $d(s,t)$ is the shortest path length between nodes $s$ and $t$. The default (that we are going to use) algorithm to compute the shortest path length is the Dijkstra algorithm. \n",
"\n",
"Since we are interested in the average shortest path length of all our connected components, for each node we need to run the Dijkstra algorithm on all the other nodes. Given the dimensions of our datasets and the slowness of networkx, computing the average shortest path length of the whole graph is not feasible.\n",
"\n",
"To overcome this problem, we can use the `average_shortest_path` function from the `utils` module to compute the average shortest path length on a random sub-sample of the graph. The functions takes as input:\n",
"\n",
"- `G: networkx graph object`: the graph on which we want to compute the average shortest path length\n",
"- `k: int (default=None)`: percentage of nodes to remove from the graph. If k is None, the average shortest path length of each connected component is computed using all the nodes of the connected component.\n",
"\n",
"And returns:\n",
"\n",
"- `float`: the average shortest path length of the graph\n",
"\n",
"The implementation is very straightforward. First we remove a random sub-sample of nodes from the graph. Then we create a list with all the connected components of the sub-sampled graph with at least 10 nodes and finally we compute the average shortest path length using the networkx function `average_shortest_path_length`. The choice of 10 nodes is arbitrary and based on empirical observations. We do that to avoid creating small communities with a very low average shortest path length that could bias our results.\n",
"\n",
"Depending on the machine and the time available, we can choose different values for `k`. Lower values will give us a more precise result, but will take longer to compute. On the other hand, higher values will give us a less precise result, but will be faster to compute. However, this time this is not a too much time consuming operation. So if we are willing to wait a bit, I suggest to use `k=None` and test it one the whole graph.\n",
"\n",
"\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": 18,
"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 60.0% of nodes: 2598\n",
"\tNumber of edges after removing 60.0% of nodes: 47438\n",
"\tNumber of connected components with more then 10 nodes: 1 \n",
"\tAverage shortest path length: 3.15ngth of connected component with 2271 nodes and 47385 edges \n",
"\tCPU time: 9.0 seconds\n",
"\n",
"Computing average shortest path length for graph: Gowalla Checkins Graph\n",
"\tNumber of nodes after removing 60.0% of nodes: 1230\n",
"\tNumber of edges after removing 60.0% of nodes: 10245\n",
"\tNumber of connected components with more then 10 nodes: 1 \n",
"\tAverage shortest path length: 3.88ngth of connected component with 1006 nodes and 10203 edges \n",
"\tCPU time: 1.4 seconds\n",
"\n",
"Computing average shortest path length for graph: Foursquare Checkins Graph\n",
"\tNumber of nodes after removing 60.0% of nodes: 930\n",
"\tNumber of edges after removing 60.0% of nodes: 39132\n",
"\tNumber of connected components with more then 10 nodes: 1 \n",
"\tAverage shortest path length: 2.19ngth of connected component with 877 nodes and 39130 edges \n",
"\tCPU time: 2.5 seconds\n",
"\n",
"Computing average shortest path length for graph: Brightkite Friendship Graph\n",
"\tNumber of nodes after removing 60.0% of nodes: 600\n",
"\tNumber of edges after removing 60.0% of nodes: 152\n",
"\tNumber of connected components with more then 10 nodes: 4 \n",
"\tAverage shortest path length: 10.52gth of connected component with 11 nodes and 12 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 60.0% of nodes: 600\n",
"\tNumber of edges after removing 60.0% of nodes: 338\n",
"\tNumber of connected components with more then 10 nodes: 2 \n",
"\tAverage shortest path length: 9.47ngth of connected component with 11 nodes and 13 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 60.0% of nodes: 559\n",
"\tNumber of edges after removing 60.0% of nodes: 877\n",
"\tNumber of connected components with more then 10 nodes: 1 \n",
"\tAverage shortest path length: 3.92ngth of connected component with 304 nodes and 822 edges \n",
"\tCPU time: 0.1 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.148947</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Gowalla Checkins Graph</td>\n",
" <td>3.882923</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Foursquare Checkins Graph</td>\n",
" <td>2.190448</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Brightkite Friendship Graph</td>\n",
" <td>10.51695</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Gowalla Friendship Graph</td>\n",
" <td>9.470371</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>Foursquare Friendship Graph</td>\n",
" <td>3.921552</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Graph Average Shortest Path Length\n",
"0 Brightkite Checkins Graph 3.148947\n",
"1 Gowalla Checkins Graph 3.882923\n",
"2 Foursquare Checkins Graph 2.190448\n",
"3 Brightkite Friendship Graph 10.51695\n",
"4 Gowalla Friendship Graph 9.470371\n",
"5 Foursquare Friendship Graph 3.921552"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# if you want just to test it out, leave k = 0.6, 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.6)\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": [
"## Betweenness Centrality\n",
"\n",
"The importance of a node in a network depends on many factors. A website may be important due to its content, a router due to its capacity. Of course, all of these properties depend on the nature\n",
"of the studied network, and may have very little to do with the graph structure of the network. We are particularly interested in the importance of a node (or a link) due to its topological function in the network. It is reasonable to assume that the topology of a network may dictate some intrinsic importance for different nodes. One measure of centrality can be the degree of a\n",
"node. The higher the degree, the more the node is connected, and therefore, the higher is its centrality in the network. However, the degree is not the only factor determining a node's importance \n",
"\n",
"One of the most accepted definitions of centrality is based on counting paths going through a node. For each node, i, in the network, the number of “routing” paths to all other nodes (i.e., paths through which data flow) going through i is counted, and this number determines the centrality i. The most common selection is taking only\n",
"the shortest paths as the routing paths. This leads to the following definition: the _betweenness centrality_ of a node, i, equals the number of shortest paths between all pairs of nodes in the network going through it, i.e.,\n",
"\n",
"\\begin{equation} \n",
" g(i) = \\sum_{\\{ j,k \\}} g_i (j,k)\n",
"\\end{equation}\n",
"\n",
"where the notation $\\{j, k\\}$ stands for summing 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 fact, in networks with no weight (i.e., where all edges have the same length), there might be more than one shortest path. In that case, it is common 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 going through $i$. \n",
"\n",
"> Several variations of this scheme exist, focusing, in particular, on how to count distinct shortest paths (if several shortest paths share some edges). These differences tend to have a very small statistical influence in random complex networks, where the number of short loops is small. Therefore, we will concentrate on the above definition. Another nuance is whether the source and destination are considered part of the shortest path.\n",
"\n",
"The usefulness of the betweenness centrality in identifying bottlenecks and important nodes in the network has led to applications in identifying communities in biological and social networks.\n",
"\n",
"--- \n",
"\n",
"Let's see how to compute this centrality measure on our networks. The networkx library has a function that computes the betweenness centrality of all nodes in a network. It is based on the algorithm proposed in the paper\n",
"\n",
"_- Ulrik Brandes, A Faster Algorithm for Betweenness Centrality, Journal of Mathematical Sociology, 25(2):163-177, 2001._\n",
"\n",
"Even if this is a very fast algorithm, it's node enough to run in a reasonable time on large networks. Using the same idea of the previous sections, we can take samplings of our original graph, obtaining an approximate results. Unfortunately, I observed that even with heavy sampling, the time required to run the algorithm is still very high. To avoid using even more heavier samplings (that would bias the results), I decided to use a different approach: parallelization!\n",
"\n",
"In the `utils` module I implemented a function called `betweenness_centrality_parallel`. The function takes as input\n",
"\n",
"- `G: networkx graph object`: the graph on which we want to compute the average shortest path length\n",
"- `processes : int (optional)` The number of processes to use for computation. If `None` (default), processes is set to 1 and the standard betweenness algorithm is used.\n",
"- `k: int (default=None)`: percentage of nodes to remove from the graph. If k is None, the average shortest path length of each connected component is computed using all the nodes of the connected component.\n",
"\n",
"> **Memory Note:** Do not use more then 6 process for big graphs, otherwise the memory will be full. Do it only if you have more at least 32 GB of RAM. For small graphs, you can use more processes.\n",
"\n",
"The implemented functions divide the network in chunks of nodes and compute their contribution to the betweenness centrality of the whole network. Each chunk is computed in parallel, and the results are summed up to obtain the final result. The function returns a dictionary with the betweenness centrality of each node. For more information, see the function code in the `utils` module.\n",
"\n",
"Depending on the machine and the time available, we can choose different values for `k`. Lower values will give us a more precise result, but will take longer to compute. On the other hand, higher values will give us a less precise result, but will be faster to compute. I suggest to use `k=0.6` to test very quickly the function, and at least `k=0.2` to get a more precise result."
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Computing the approximate betweenness centrality for the Brightkite Checkins Graph...\n",
"\tNumber of nodes after removing 50.0% of nodes: 3247\n",
"\tNumber of edges after removing 50.0% of nodes: 69391\n",
"\tBetweenness centrality: 0.0005307982194405889 \n",
"\tCPU time: 20.0 seconds\n",
"\n",
"Computing the approximate betweenness centrality for the Gowalla Checkins Graph...\n",
"\tNumber of nodes after removing 50.0% of nodes: 1537\n",
"\tNumber of edges after removing 50.0% of nodes: 15620\n",
"\tBetweenness centrality: 0.001411013627305332 \n",
"\tCPU time: 3.3 seconds\n",
"\n",
"Computing the approximate betweenness centrality for the Foursquare Checkins Graph...\n",
"\tNumber of nodes after removing 50.0% of nodes: 1162\n",
"\tNumber of edges after removing 50.0% of nodes: 60503\n",
"\tBetweenness centrality: 0.0009583311032089305 \n",
"\tCPU time: 6.6 seconds\n",
"\n",
"Computing the approximate betweenness centrality for the Brightkite Friendship Graph...\n",
"\tNumber of nodes after removing 50.0% of nodes: 750\n",
"\tNumber of edges after removing 50.0% of nodes: 290\n",
"\tBetweenness centrality: 4.090064232999912e-05 \n",
"\tCPU time: 0.3 seconds\n",
"\n",
"Computing the approximate betweenness centrality for the Gowalla Friendship Graph...\n",
"\tNumber of nodes after removing 50.0% of nodes: 750\n",
"\tNumber of edges after removing 50.0% of nodes: 569\n",
"\tBetweenness centrality: 0.0014667114084376317 \n",
"\tCPU time: 0.4 seconds\n",
"\n",
"Computing the approximate betweenness centrality for the Foursquare Friendship Graph...\n",
"\tNumber of nodes after removing 50.0% of nodes: 699\n",
"\tNumber of edges after removing 50.0% of nodes: 1211\n",
"\tBetweenness centrality: 0.0017532274030122956 \n",
"\tCPU time: 0.4 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.000531</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Gowalla Checkins Graph</td>\n",
" <td>0.001411</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Foursquare Checkins Graph</td>\n",
" <td>0.000958</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Brightkite Friendship Graph</td>\n",
" <td>0.000041</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Gowalla Friendship Graph</td>\n",
" <td>0.001467</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>Foursquare Friendship Graph</td>\n",
" <td>0.001753</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Graph betweenness centrality\n",
"0 Brightkite Checkins Graph 0.000531\n",
"1 Gowalla Checkins Graph 0.001411\n",
"2 Foursquare Checkins Graph 0.000958\n",
"3 Brightkite Friendship Graph 0.000041\n",
"4 Gowalla Friendship Graph 0.001467\n",
"5 Foursquare Friendship Graph 0.001753"
]
},
"execution_count": 19,
"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.5).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']]"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Download the dataframe with accurate results\n",
"\n",
"I have computed all the measures above on a server with as less sampling as possible. The computation took a lot of time, but are inevitably more precise. From now on, we will refer to those results"
]
},
{
"cell_type": "code",
"execution_count": 20,
"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>90.242723</td>\n",
" <td>0.713999</td>\n",
" <td>8.778480</td>\n",
" <td>3.157626</td>\n",
" <td>0.000533</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>40.865604</td>\n",
" <td>0.548372</td>\n",
" <td>8.030410</td>\n",
" <td>3.827384</td>\n",
" <td>0.001395</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>212.30809</td>\n",
" <td>0.65273</td>\n",
" <td>7.751045</td>\n",
" <td>2.217319</td>\n",
" <td>0.000964</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>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",
" <td>NaN</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",
" <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>7.620616</td>\n",
" <td>0.183485</td>\n",
" <td>7.242082</td>\n",
" <td>3.868567</td>\n",
" <td>0.001803</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 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 omega-coefficient \n",
"0 0.000533 NaN \n",
"1 0.001395 NaN \n",
"2 0.000964 NaN \n",
"3 0.000039 NaN \n",
"4 0.001483 NaN \n",
"5 0.001803 NaN "
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# https://github.com/lukefleed/small-worlds/raw/main/omega_results.pkl\n",
"\n",
"analysis_results = pd.read_pickle('analysis_results.pkl')\n",
"analysis_results"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Analysis of the results"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"### Distribution of Degree\n",
"\n",
"In the previous section we have seen that a scale-free network is a type of network where a few nodes have many more connections than the majority of nodes, resulting in a skewed distribution of node degrees (number of connections). This means that there are \"hubs\" or high-degree nodes in the network that play a disproportionate role in the network's structure and function. On the other hand, in a random network, nodes have approximately the same number of connections, and there is a more uniform distribution of node degrees.\n",
"\n",
"---\n",
"\n",
"Let's see if our networks are scale-free or not. We can use the `degree_distribution` function from the `utils` module to plot the degree distribution of a graph. It takes a networkx graph object as input and returns a plot of the degree distribution. We expect to see a power-law distribution and not a Poissonian one."
]
},
{
"cell_type": "code",
"execution_count": 21,
"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=\"abb91a25-9d00-4cab-9b27-c962b2db9c56\" 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(\"abb91a25-9d00-4cab-9b27-c962b2db9c56\")) { Plotly.newPlot( \"abb91a25-9d00-4cab-9b27-c962b2db9c56\", [{\"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('abb91a25-9d00-4cab-9b27-c962b2db9c56');\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=\"19b6c155-d5d0-45a0-b059-f3d23cbc0f7f\" 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(\"19b6c155-d5d0-45a0-b059-f3d23cbc0f7f\")) { Plotly.newPlot( \"19b6c155-d5d0-45a0-b059-f3d23cbc0f7f\", [{\"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('19b6c155-d5d0-45a0-b059-f3d23cbc0f7f');\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=\"3ef61edc-b8a2-44ea-bcdf-2c8e9b339315\" 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(\"3ef61edc-b8a2-44ea-bcdf-2c8e9b339315\")) { Plotly.newPlot( \"3ef61edc-b8a2-44ea-bcdf-2c8e9b339315\", [{\"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('3ef61edc-b8a2-44ea-bcdf-2c8e9b339315');\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": 22,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"name": "Degree Distribution",
"type": "bar",
"x": [
3,
7,
0,
2,
1,
6,
5,
13,
9,
23,
11,
12,
17,
10,
61,
4,
14,
16,
18,
15,
21,
8
],
"y": [
89,
18,
612,
163,
464,
22,
36,
6,
5,
1,
6,
3,
2,
7,
1,
46,
2,
1,
1,
2,
4,
9
]
}
],
"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=\"5446e5b6-17f2-4066-a7f5-1fb071707f91\" 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(\"5446e5b6-17f2-4066-a7f5-1fb071707f91\")) { Plotly.newPlot( \"5446e5b6-17f2-4066-a7f5-1fb071707f91\", [{\"name\":\"Degree Distribution\",\"x\":[3,7,0,2,1,6,5,13,9,23,11,12,17,10,61,4,14,16,18,15,21,8],\"y\":[89,18,612,163,464,22,36,6,5,1,6,3,2,7,1,46,2,1,1,2,4,9],\"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\":true
" \n",
"var gd = document.getElementById('5446e5b6-17f2-4066-a7f5-1fb071707f91');\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": [
20,
2,
45,
17,
32,
10,
1,
15,
7,
9,
4,
14,
13,
11,
8,
0,
5,
12,
27,
24,
3,
16,
6,
28,
48,
34,
31,
19,
35,
37,
22,
23,
18
],
"y": [
6,
270,
1,
9,
2,
14,
514,
6,
37,
14,
100,
4,
8,
5,
17,
210,
66,
6,
1,
4,
139,
11,
40,
2,
1,
2,
1,
2,
1,
1,
1,
3,
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 Gowalla Friendship Graph"
},
"width": 800,
"xaxis": {
"title": {
"text": "Degree"
}
},
"yaxis": {
"title": {
"text": "Number of Nodes"
}
}
}
},
"text/html": [
"<div> <div id=\"7368c5ed-d6ac-4fac-b8fb-cf4e308348fc\" 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(\"7368c5ed-d6ac-4fac-b8fb-cf4e308348fc\")) { Plotly.newPlot( \"7368c5ed-d6ac-4fac-b8fb-cf4e308348fc\", [{\"name\":\"Degree Distribution\",\"x\":[20,2,45,17,32,10,1,15,7,9,4,14,13,11,8,0,5,12,27,24,3,16,6,28,48,34,31,19,35,37,22,23,18],\"y\":[6,270,1,9,2,14,514,6,37,14,100,4,8,5,17,210,66,6,1,4,139,11,40,2,1,2,1,2,1,1,1,3,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\"}],\"mesh3d\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"mesh3d\"}],\"parcoords\":[{\"line\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":
" \n",
"var gd = document.getElementById('7368c5ed-d6ac-4fac-b8fb-cf4e308348fc');\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=\"31643092-6030-41de-8876-c521ab0b3807\" 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(\"31643092-6030-41de-8876-c521ab0b3807\")) { Plotly.newPlot( \"31643092-6030-41de-8876-c521ab0b3807\", [{\"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('31643092-6030-41de-8876-c521ab0b3807');\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": [
"As we can clearly see from the graphs obtained, the degree distribution of the networks is not Poissonian, but rather scale-free. This is a good indication that the networks are not random, but rather small-world.\n",
"\n",
"Let's try to plot the distribution degree of a random Watts-Strogatz graph with the same number of nodes and a probability of edge creation equal to the number of edges of the network divided by the number of possible edges. We expect to see a Poissonian distribution.\n",
"\n",
"> This is a time saving approach, NOT a rigorous one. If we want to be rigorous, should follow the algorithm proposed by Maslov and Sneppen, implemented in the the networkx function `random_reference`."
]
},
{
"cell_type": "code",
"execution_count": 23,
"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": [
218,
210,
194,
204,
197,
207,
214,
219,
217,
213,
208,
231,
209,
224,
199,
220,
205,
201,
202,
228,
238,
230,
200,
235,
223,
206,
211,
189,
229,
215,
236,
195,
227,
216,
233,
221,
222,
212,
196,
225,
190,
226,
234,
198,
191,
186,
192,
203,
232,
193,
237,
185,
184,
188,
187,
245,
183,
239,
241,
242,
246,
181
],
"y": [
69,
88,
17,
58,
35,
78,
85,
73,
76,
94,
93,
15,
97,
44,
41,
59,
84,
55,
50,
29,
3,
22,
62,
10,
46,
83,
92,
4,
18,
90,
11,
20,
29,
96,
11,
53,
57,
76,
24,
41,
2,
35,
11,
41,
12,
4,
15,
56,
12,
17,
2,
3,
2,
6,
3,
5,
1,
3,
3,
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 Checkins Graph - Watts-Strogatz similarity"
},
"width": 800,
"xaxis": {
"title": {
"text": "Degree"
}
},
"yaxis": {
"title": {
"text": "Number of Nodes"
}
}
}
},
"text/html": [
"<div> <div id=\"c7782f44-53d5-4279-8b27-b70b727bc6aa\" 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(\"c7782f44-53d5-4279-8b27-b70b727bc6aa\")) { Plotly.newPlot( \"c7782f44-53d5-4279-8b27-b70b727bc6aa\", [{\"name\":\"Degree Distribution\",\"x\":[218,210,194,204,197,207,214,219,217,213,208,231,209,224,199,220,205,201,202,228,238,230,200,235,223,206,211,189,229,215,236,195,227,216,233,221,222,212,196,225,190,226,234,198,191,186,192,203,232,193,237,185,184,188,187,245,183,239,241,242,246,181],\"y\":[69,88,17,58,35,78,85,73,76,94,93,15,97,44,41,59,84,55,50,29,3,22,62,10,46,83,92,4,18,90,11,20,29,96,11,53,57,76,24,41,2,35,11,41,12,4,15,56,12,17,2,3,2,6,3,5,1,3,3,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\":[{\"marker\":{\
" \n",
"var gd = document.getElementById('c7782f44-53d5-4279-8b27-b70b727bc6aa');\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": [
203,
211,
198,
223,
218,
205,
215,
188,
222,
226,
216,
221,
213,
214,
217,
206,
199,
219,
232,
200,
229,
204,
201,
212,
209,
202,
207,
220,
225,
208,
228,
192,
210,
238,
234,
233,
195,
231,
193,
224,
194,
180,
196,
197,
183,
248,
191,
246,
227,
182,
235,
190,
230,
236,
189,
242,
237,
186,
249,
255,
241,
187,
251,
170,
239
],
"y": [
78,
74,
38,
39,
68,
87,
88,
4,
58,
35,
95,
59,
75,
83,
91,
63,
41,
63,
14,
53,
26,
66,
48,
96,
84,
70,
79,
70,
37,
91,
38,
18,
93,
4,
8,
14,
18,
16,
18,
48,
23,
1,
32,
25,
1,
1,
6,
1,
21,
2,
9,
8,
21,
5,
4,
1,
3,
1,
2,
1,
2,
3,
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 Checkins Graph - Watts-Strogatz similarity"
},
"width": 800,
"xaxis": {
"title": {
"text": "Degree"
}
},
"yaxis": {
"title": {
"text": "Number of Nodes"
}
}
}
},
"text/html": [
"<div> <div id=\"0440913c-b5cf-4092-aae8-0078a7effa12\" 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(\"0440913c-b5cf-4092-aae8-0078a7effa12\")) { Plotly.newPlot( \"0440913c-b5cf-4092-aae8-0078a7effa12\", [{\"name\":\"Degree Distribution\",\"x\":[203,211,198,223,218,205,215,188,222,226,216,221,213,214,217,206,199,219,232,200,229,204,201,212,209,202,207,220,225,208,228,192,210,238,234,233,195,231,193,224,194,180,196,197,183,248,191,246,227,182,235,190,230,236,189,242,237,186,249,255,241,187,251,170,239],\"y\":[78,74,38,39,68,87,88,4,58,35,95,59,75,83,91,63,41,63,14,53,26,66,48,96,84,70,79,70,37,91,38,18,93,4,8,14,18,16,18,48,23,1,32,25,1,1,6,1,21,2,9,8,21,5,4,1,3,1,2,1,2,3,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('0440913c-b5cf-4092-aae8-0078a7effa12');\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": [
222,
219,
229,
195,
191,
223,
221,
205,
220,
214,
226,
215,
209,
198,
199,
210,
211,
197,
188,
216,
212,
201,
218,
213,
225,
208,
200,
194,
193,
202,
206,
196,
224,
204,
227,
207,
190,
217,
203,
192,
228,
240,
232,
235,
230,
238,
233,
231,
189,
180,
239,
234,
236,
242,
237,
247,
184,
243,
181,
187,
244,
241,
186,
172
],
"y": [
43,
76,
23,
16,
10,
44,
55,
66,
60,
95,
24,
99,
86,
34,
48,
83,
77,
37,
6,
76,
92,
41,
70,
100,
45,
92,
51,
12,
16,
64,
84,
23,
50,
70,
28,
78,
11,
93,
72,
14,
33,
1,
17,
7,
17,
9,
8,
19,
8,
1,
2,
7,
6,
3,
5,
1,
2,
2,
2,
3,
1,
1,
4,
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=\"b7404f6e-c177-4bba-9376-d45fcc526c42\" 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(\"b7404f6e-c177-4bba-9376-d45fcc526c42\")) { Plotly.newPlot( \"b7404f6e-c177-4bba-9376-d45fcc526c42\", [{\"name\":\"Degree Distribution\",\"x\":[222,219,229,195,191,223,221,205,220,214,226,215,209,198,199,210,211,197,188,216,212,201,218,213,225,208,200,194,193,202,206,196,224,204,227,207,190,217,203,192,228,240,232,235,230,238,233,231,189,180,239,234,236,242,237,247,184,243,181,187,244,241,186,172],\"y\":[43,76,23,16,10,44,55,66,60,95,24,99,86,34,48,83,77,37,6,76,92,41,70,100,45,92,51,12,16,64,84,23,50,70,28,78,11,93,72,14,33,1,17,7,17,9,8,19,8,1,2,7,6,3,5,1,2,2,2,3,1,1,4,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\":[{\"m
" \n",
"var gd = document.getElementById('b7404f6e-c177-4bba-9376-d45fcc526c42');\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": 24,
"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": [
217,
210,
226,
211,
207,
200,
221,
224,
202,
214,
227,
215,
223,
222,
216,
196,
198,
231,
208,
197,
203,
206,
205,
212,
218,
228,
219,
192,
191,
199,
239,
209,
232,
220,
204,
195,
213,
201,
229,
193,
225,
181,
194,
185,
190,
234,
233,
242,
189,
188,
238,
237,
230,
241,
235,
182,
177,
245,
236,
180,
186,
244,
187,
249,
240,
246
],
"y": [
86,
102,
31,
80,
85,
54,
49,
31,
59,
100,
37,
86,
47,
45,
86,
26,
33,
26,
78,
33,
63,
87,
61,
98,
81,
27,
69,
11,
15,
29,
3,
92,
10,
70,
75,
23,
88,
50,
25,
16,
27,
1,
19,
4,
7,
6,
13,
3,
6,
9,
2,
5,
20,
3,
12,
1,
1,
1,
5,
1,
1,
2,
3,
1,
3,
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=\"4ade478e-1750-45f2-9334-7f635ca9741f\" 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(\"4ade478e-1750-45f2-9334-7f635ca9741f\")) { Plotly.newPlot( \"4ade478e-1750-45f2-9334-7f635ca9741f\", [{\"name\":\"Degree Distribution\",\"x\":[217,210,226,211,207,200,221,224,202,214,227,215,223,222,216,196,198,231,208,197,203,206,205,212,218,228,219,192,191,199,239,209,232,220,204,195,213,201,229,193,225,181,194,185,190,234,233,242,189,188,238,237,230,241,235,182,177,245,236,180,186,244,187,249,240,246],\"y\":[86,102,31,80,85,54,49,31,59,100,37,86,47,45,86,26,33,26,78,33,63,87,61,98,81,27,69,11,15,29,3,92,10,70,75,23,88,50,25,16,27,1,19,4,7,6,13,3,6,9,2,5,20,3,12,1,1,1,5,1,1,2,3,1,3,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\"}],\"his
" \n",
"var gd = document.getElementById('4ade478e-1750-45f2-9334-7f635ca9741f');\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": [
213,
206,
207,
214,
194,
196,
198,
211,
216,
218,
220,
208,
217,
203,
197,
212,
219,
221,
229,
226,
215,
189,
209,
210,
202,
223,
195,
231,
204,
201,
199,
205,
227,
236,
241,
222,
224,
200,
192,
239,
230,
225,
233,
242,
234,
183,
191,
235,
238,
232,
190,
179,
228,
185,
184,
237,
178,
193,
188,
243,
186,
187,
248,
247,
246,
240
],
"y": [
82,
74,
72,
82,
21,
36,
33,
87,
81,
65,
78,
84,
80,
78,
30,
84,
95,
70,
18,
27,
86,
4,
86,
77,
62,
44,
30,
15,
54,
56,
34,
94,
35,
4,
1,
69,
53,
51,
13,
4,
25,
22,
18,
2,
11,
2,
7,
5,
4,
8,
9,
2,
18,
2,
1,
4,
3,
12,
4,
5,
4,
2,
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 of Gowalla Friendship Graph - Watts-Strogatz similarity"
},
"width": 800,
"xaxis": {
"title": {
"text": "Degree"
}
},
"yaxis": {
"title": {
"text": "Number of Nodes"
}
}
}
},
"text/html": [
"<div> <div id=\"574d60fe-5de8-4782-a27f-05f2c23159da\" 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(\"574d60fe-5de8-4782-a27f-05f2c23159da\")) { Plotly.newPlot( \"574d60fe-5de8-4782-a27f-05f2c23159da\", [{\"name\":\"Degree Distribution\",\"x\":[213,206,207,214,194,196,198,211,216,218,220,208,217,203,197,212,219,221,229,226,215,189,209,210,202,223,195,231,204,201,199,205,227,236,241,222,224,200,192,239,230,225,233,242,234,183,191,235,238,232,190,179,228,185,184,237,178,193,188,243,186,187,248,247,246,240],\"y\":[82,74,72,82,21,36,33,87,81,65,78,84,80,78,30,84,95,70,18,27,86,4,86,77,62,44,30,15,54,56,34,94,35,4,1,69,53,51,13,4,25,22,18,2,11,2,7,5,4,8,9,2,18,2,1,4,3,12,4,5,4,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\"}],\"histogr
" \n",
"var gd = document.getElementById('574d60fe-5de8-4782-a27f-05f2c23159da');\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": [
217,
203,
211,
210,
226,
213,
216,
197,
232,
219,
198,
201,
205,
202,
207,
214,
223,
194,
209,
208,
221,
220,
237,
199,
204,
233,
184,
215,
192,
206,
228,
229,
200,
225,
218,
230,
212,
195,
222,
227,
239,
191,
196,
186,
224,
188,
246,
190,
193,
231,
178,
189,
180,
235,
238,
244,
236,
234,
240,
187,
181,
241,
243,
182,
242,
185
],
"y": [
93,
58,
97,
84,
39,
86,
99,
25,
13,
76,
35,
50,
61,
54,
111,
111,
41,
13,
86,
84,
76,
71,
7,
41,
66,
7,
2,
89,
8,
69,
21,
18,
44,
25,
70,
18,
79,
23,
64,
38,
4,
11,
32,
4,
31,
6,
1,
8,
16,
12,
1,
9,
1,
3,
4,
1,
5,
7,
2,
5,
1,
2,
1,
1,
2,
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=\"2b66e643-bc88-4b42-8605-7c89d4c2785f\" 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(\"2b66e643-bc88-4b42-8605-7c89d4c2785f\")) { Plotly.newPlot( \"2b66e643-bc88-4b42-8605-7c89d4c2785f\", [{\"name\":\"Degree Distribution\",\"x\":[217,203,211,210,226,213,216,197,232,219,198,201,205,202,207,214,223,194,209,208,221,220,237,199,204,233,184,215,192,206,228,229,200,225,218,230,212,195,222,227,239,191,196,186,224,188,246,190,193,231,178,189,180,235,238,244,236,234,240,187,181,241,243,182,242,185],\"y\":[93,58,97,84,39,86,99,25,13,76,35,50,61,54,111,111,41,13,86,84,76,71,7,41,66,7,2,89,8,69,21,18,44,25,70,18,79,23,64,38,4,11,32,4,31,6,1,8,16,12,1,9,1,3,4,1,5,7,2,5,1,2,1,1,2,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\"}],\"histog
" \n",
"var gd = document.getElementById('2b66e643-bc88-4b42-8605-7c89d4c2785f');\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."
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## The Small-World Model\n",
"\n",
"Let's start by clarifying that real networks are not random. Their formation and development are dictated by a combination of many different processes and influences. These influencing conditions include natural limitations and processes, human considerations such as optimal performance and robustness, economic considerations, natural selection and many others. Controversies still exist regarding the measure to which random models represent real-world networks. However, in this section we will focus on random network models and attempt to show if their properties may still be used to study properties of our real-world networks. \n",
"\n",
"Many real-world networks have many properties that cannot be explained by the ER model. One such property is the high clustering observed in many real-world networks. This led Watts and Strogatz to develop an alternative model, called the “small-world” model. Quoting their paper:\n",
"\n",
"> \"highly clustered, like regular lattices, yet have small characteristic path lengths, like random graphs\"\n",
"\n",
"Their idea was to begin with an ordered lattice, such as the $k$-ring (a ring where each site is connected to its $2k$ nearest neighbors - $k$ from each side) or the two-dimensional lattice. For each site, each of the links emanating from it is removed with probability $\\varphi$ and is rewired to a randomly selected site in the network. In other words, small-world networks have the unique ability to have specialized nodes or regions within a network while simultaneously exhibiting shared or distributed processing across all of the communicating nodes within a network. \n",
"\n",
"![small-world](https://i.imgur.com/gX4Eutx.png)\n",
"![small-world](https://i.imgur.com/B95uS5O.png)"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Small-Worldness"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"Given the unique processing or information transfer capabilities of small-world networks, it is vital to determine whether this is a universal property of naturally occurring networks or whether small-world properties are restricted to specialized networks. An overly liberal definition of small-worldness might miss the specific benefits of these networks\n",
2 years ago
"\n",
"> high clustering and low path length\n",
"\n",
"and obscure them with networks more closely associated with regular lattices and random networks. A possible definition of a small-world network is that it has clustering similar to a regular lattice and path length similar to a random network. However, in practice, networks are typically defined as small-world by comparing clustering and path length to those of a comparable random network _(Humphries et al., 2006)_. Unfortunately, this means that networks with very low clustering can be, and indeed are, defined as small-world. We need a method that is able to distinguish true small-world networks from those that are more closely aligned with random or lattice structures and overestimates the occurrence of small-world networks. Networks that are more similar to random or lattice structures are interesting in their own right, but they do not behave like small-world networks\n",
"\n",
"## Identifying small-world networks\n",
"\n",
"Small-world networks are distinguished from other networks by two specific properties, the first being high clustering ($C$) among nodes. High clustering supports specialization as local collections of strongly interconnected nodes readily share information or resources. 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. 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.\n",
"\n",
"The WS model 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.\n",
"\n",
"### A first approach: the $\\sigma$ coefficient\n",
"\n",
"In 2006, Humphries and colleagues introduced a quantitative metric, small-world coefficient $\\sigma$, that uses a ratio of network clustering and path length compared to its random network equivalent. In this quantitative approach, $C$ and $L$ are measured against those of their equivalent derived random networks ($C_{rand}$ and $L_{rand}$, respectively) to generate the ratios $c = C/C_{rand}$ and $k = L/L_{rand}$. These ratios are then used to calculate the small-coefficient as:\n",
"$$ \\sigma = \\frac{C/C_{rand}}{L/L_{rand}} = \\frac{c}{k} $$\n",
"The conditions that must be met for a network to be classified as small-world are $C \\gg C_{rand}$ and $L \\approx L_{rand}$, which results in $\\sigma > 1$. As it turns out, a major issue with $\\sigma$ is that the clustering coefficient of the equivalent random network greatly influences the small-world coefficient. In the small-world coefficient equation, $\\sigma$ uses the relationship between $C$ and $C_{rand}$ to determine the value of $c$. Since clustering in a random network is typically extremely low (Humphries and Gurney, 2008; Watts and Strogatz, 1998) the value of $\\sigma$ can be unduly influenced by only small changes in $C_{rand}$. \n",
"\n",
"### A more solid approach: the $\\omega$ coefficient\n",
"\n",
"Given a graph with characteristic path length, $L$, and clustering, $C$, the small-world measurement, $\\omega$, is defined by comparing the clustering of the network to that of an equivalent lattice network, $C_{latt}$, and comparing path length to that of an equivalent random network, $L_{rand}$; the relationship\n",
"is simply the difference of two ratios defined as:\n",
"$$ \\omega = \\frac{L_{rand}}{L} - \\frac{C}{C_{latt}} $$\n",
"In using the clustering of an equivalent lattice network rather than a random network, this metric is less susceptible to the fluctuations seen with $C_{rand}$. Moreover, values of $\\gamma$ are restricted to the interval $-1$ to $1$ regardless of network size.\n",
"\n",
"Values close to zero are considered small world. Positive values indicate a graph with more random characteristics, while negative values indicate a graph with more regular, or lattice-like, characteristics.\n",
"\n",
"#### Lattice network construction\n",
"\n",
"In the paper [1] the lattice network was generated by using a modified version of the latticization algorithm (Sporns and Zwi,2004) found in the brain connectivity toolbox (Rubinov and Sporns, 2010). The procedure is based on a Markov-chain algorithm that maintains node degree and swaps edges with uniform probability; however, swaps are carried out only if the resulting matrix has entries that are closer to the main diagonal. To optimize the clustering coefficient of the lattice network, the latticization procedure is performed over several user-defined repetitions. Storing the initial adjacency matrix and its clustering coefficient, the latticization procedure is performed on the matrix. If the clustering coefficient of the resulting matrix is lower, the initial matrix is kept and latticization is performed again on the same matrix; if the clustering coefficient is higher, then the initial adjacency matrix is replaced. This latticization process is repeated until clustering is maximized. This process results in a highly clustered network with long path length approximating a lattice topology. To decrease the processing time in larger networks, a sliding window procedure was developed. Smaller sections of the matrix are sampled along the main diagonal, latticized, and reinserted into the larger matrix in a step-wise fashion.\n",
"\n",
"#### Limitations\n",
"\n",
"Although latticization is fast in smaller networks, large networks such as the Internet can take several days to generate and optimize. The latticization procedure described here uses an algorithm developed by Sporns and Zwi in 2004, but the algorithm was used on much smaller datasets. \n",
2 years ago
"\n",
"Furthermore, $\\omega$ is limited by networks that have very low clustering that cannot be appreciably increased, such as networks with 'super hubs' or hierarchical networks. In hierarchical networks, the nodes are often configured in branches that contain little to no clustering. In networks with super hubs, the network may contain a hub that has a node with a degree that is several times in magnitude greater than the next most connected hub. In both these networks, there are fewer configurations to increase the clustering of the network. Moreover, in a targeted assault of these networks, the topology is easily destroyed (Albert et al., 2000). Such vulnerability to attack signifies a network that may not be small-world."
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"### Omega coefficient computation\n",
"\n",
"The computation of the omega coefficient, is a time-consuming process. To efficiently compare the clustering coefficient and the shortest path length, we need to build both the lattice reference network and the random reference network multiple times. The algorithm for computing the omega coefficient is as follows:\n",
"\n",
"1. Generates a random sample of the network\n",
"2. Performes a specified number of rewiring operations per edge to compute the equivalent random graph\n",
"3. Computing the average clustering coefficient and average shortest path length for a specified number of random graphs and then averaging the results\n",
"4. Computes the omega coefficient for the random sample with formula stated above\n",
" \n",
"Despite the aforementioned technique, the computation of the omega coefficient is still computationally intensive. To mitigate over-sampling and potential bias, the computation was performed on a subset of the network with cardinality $|N|/2$. Additionally, both the number of rewiring operations per edge and the number of random graphs were set to $3$.\n",
"\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 can be accessed in the form of a pandas dataframe (next section)"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"---\n",
"\n",
"In the repository there is a python program `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 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 higher values of k, niter or nrand. The computation of this networks with k=0.5, niter=3 and nrand=3 requires from 3 to 10 days to complete. If you want to test it out, you can use the `checkins-brightkite` graph with k=0.1, niter=1 and nrand=1.\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.\n",
"\n"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# Are our networks small-world?\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\n",
"\n",
"## Degree distribution\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.\n",
"\n",
"## Betweenness centrality\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": 1,
"metadata": {},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'graphs_all' is not defined",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[1], line 8\u001b[0m\n\u001b[1;32m 5\u001b[0m model_name \u001b[39m=\u001b[39m \u001b[39m'\u001b[39m\u001b[39merdos_renyi\u001b[39m\u001b[39m'\u001b[39m\n\u001b[1;32m 7\u001b[0m random_graphs \u001b[39m=\u001b[39m {}\n\u001b[0;32m----> 8\u001b[0m \u001b[39mfor\u001b[39;00m graph \u001b[39min\u001b[39;00m graphs_all:\n\u001b[1;32m 9\u001b[0m G \u001b[39m=\u001b[39m create_random_graphs(graph, model\u001b[39m=\u001b[39mmodel_name, save \u001b[39m=\u001b[39m \u001b[39mFalse\u001b[39;00m)\n\u001b[1;32m 10\u001b[0m \u001b[39mprint\u001b[39m(\u001b[39m\"\u001b[39m\u001b[39mRandom graph created for \u001b[39m\u001b[39m\"\u001b[39m, graph\u001b[39m.\u001b[39mname, \u001b[39m\"\u001b[39m\u001b[39m\\n\u001b[39;00m\u001b[39mStarting computation of betweenness centrality...\u001b[39m\u001b[39m\"\u001b[39m)\n",
"\u001b[0;31mNameError\u001b[0m: name 'graphs_all' is not defined"
]
}
],
"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": 22,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABcIAAAPdCAYAAACp3hugAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8o6BhiAAAACXBIWXMAAA9hAAAPYQGoP6dpAACtf0lEQVR4nOzdd5wV1f0//vfSlo6A0qSLUgREQREsgCjNXiKxINixIfZYiNhCjEaNFbFhRfzEGkWaCDGyKihgQyxBQQVRFLDR5/dHftyv61L2wq6r4/P5eNzHI/fMmTPvmZ25SV4ez+QkSZIEAAAAAACkVKmSLgAAAAAAAIqTIBwAAAAAgFQThAMAAAAAkGqCcAAAAAAAUk0QDgAAAABAqgnCAQAAAABINUE4AAAAAACpJggHAAAAACDVBOEAAAAAAKSaIBwAfsVGjhwZOTk5+T7bbLNNdO3aNZ599tnNHvf222+PkSNHFl2hZGXZsmVxzTXXRIcOHaJq1aqRm5sbjRs3jhNOOCHeeOONYj32I488EjfddFOxjd+4ceMYMGBA5vvHH38cOTk5+e63qVOnxtChQ2PJkiXFVsem3HLLLdGsWbMoV65c5OTkbLCWjdXauHHjOOCAA4q30CLStWvX6Nq162btO3To0MjJySnagtYjJycnhg4dWuzHKS6/lfth3X+vfPzxxxvtN2bMmA3+PXJycuLMM88s+uJ+hQp7vfh93RcA/DYJwgHgN+C+++6LvLy8mDp1aowYMSJKly4dBx54YPzrX//arPEE4SXno48+ip133jn++te/Rrdu3WLUqFExfvz4uOKKK+KLL76I9u3bx9KlS4vt+MUdhP9c3bp1Iy8vL/bff/9M29SpU+OKK64osSB85syZMWjQoOjWrVtMmjQp8vLyokqVKuvtW9K1FpXbb789br/99s3a96STToq8vLwirohfuzFjxsQVV1xR0mUAABSZMiVdAACwaa1bt44OHTpkvvfq1SuqV68eo0aNigMPPLAEKyMba9asiUMPPTS++uqryMvLi9atW2e2denSJfr37x/PP/98lC1btgSr/H/WrFkTq1evjtzc3M0eIzc3N3bfffcirGrLvfPOOxERcfLJJ8duu+1WwtUUrx9++CEqVqwYrVq12uwx6tevH/Xr1y/CqkrOuuvBb1OSJLF8+fKoUKFCSZfym+UZAOD3zIxwAPgNKl++fJQrV65AYLpy5cq4+uqro0WLFpGbmxvbbLNNHH/88fHll19m+jRu3DjeeeedmDJlSma5lcaNG0eSJFG7du0444wzMn3XrFkT1atXj1KlSsUXX3yRab/hhhuiTJky+WbJTp8+PQ466KCoUaNGlC9fPnbeeed47LHHCtS+cOHCOPXUU6N+/fpRrly5aNKkSVxxxRWxevXqTJ91y2lcf/31ccMNN0STJk2icuXK0alTp3jllVfyjTdgwICoXLlyfPjhh9GnT5+oXLlyNGjQIM4777xYsWJF1tcnImLSpEnRtWvXqFmzZlSoUCEaNmwYhx9+ePzwww+ZPnfccUfstNNOUbly5ahSpUq0aNEiLrnkko392eKpp56Kt956Ky6++OJ8IfhP9e7dO19I8cEHH8TRRx8dtWrVitzc3GjZsmXcdttt+faZPHly5OTkxKhRo+LSSy+NevXqRdWqVWPfffeNOXPmZPp17do1nnvuufjkk0/yLbfz02v+t7/9La6++upo0qRJ5ObmxosvvhjLly+P8847L9q1axfVqlWLGjVqRKdOneLpp5/e6Pn+dNx1/wbC0KFD44ILLoiIiCZNmmRqmDx5cpx44olRo0aNfNd5nX322Sd23HHHTR7v3nvvjZ122inKly8fNWrUiEMPPTRmz56d7xoce+yxERHRsWPHyMnJybeUy09trNafGjt2bOyyyy5RoUKFaNGiRdx7770FxirMfb8ha9eujb/97W+Z+7ZWrVpx3HHHxaeffpqvX9euXaN169bx73//Ozp37hwVK1aME044IbPt50ujfPrpp3HEEUdElSpVYquttopjjjkmpk2bVmApm/UtjbJuGZBNnfuXX34Zp59+erRq1SoqV64ctWrVin322SdeeumlTZ73hhS27nW/DW+99Vb06NEjqlSpEt27d4+IiAkTJsTBBx8c9evXj/Lly0ezZs3i1FNPja+++irfsdad+4wZM+Kwww6LqlWrRrVq1eLYY48t8LuxTmHuh/W54ooromPHjlGjRo2oWrVq7LLLLnHPPfdEkiT5+hX22kdEvPLKK7HHHntE+fLlo169enHxxRfHqlWrNlnLgAEDMr8zP/2t+PnyIA8++GC0bNkyKlasGDvttNN6l+wqzG/YhqxbamP48OHRsmXLyM3Njfvvv7/Er1e2z2ReXl507tw5KlSoEI0bN4777rsvIiKee+652GWXXaJixYrRpk2bGDt2bKGuyzvvvBM9evSIihUrxjbbbBNnnHFGPPfccwV+nzb2mzB69Ojo0aNH1K1bNypUqBAtW7aMP/3pT/H999/nO9a65+idd96J7t27R6VKlWKbbbaJM888c72/1RGFuy8AoEQkAMCv1n333ZdERPLKK68kq1atSlauXJnMnz8/GTRoUFKqVKlk7Nixmb5r1qxJevXqlVSqVCm54oorkgkTJiR33313su222yatWrVKfvjhhyRJkuSNN95ImjZtmuy8885JXl5ekpeXl7zxxhtJkiTJH//4x2SHHXbIjPnKK68kEZFUqFAhefjhhzPtvXv3TnbbbbfM90mTJiXlypVL9tprr2T06NHJ2LFjkwEDBiQRkdx3332ZfgsWLEgaNGiQNGrUKLnzzjuTiRMnJldddVWSm5ubDBgwINNv7ty5SUQkjRs3Tnr16pU89dRTyVNPPZW0adMmqV69erJkyZJM3/79+yflypVLWrZsmVx//fXJxIkTkz//+c9JTk5OcsUVV2R9febOnZuUL18+2W+//ZKnnnoqmTx5cvLwww8n/fr1S7755pskSZJk1KhRSUQkZ511VjJ+/Phk4sSJyfDhw5NBgwZt9O95yimnJBGRzJ49e5N/+yRJknfeeSepVq1a0qZNm+SBBx5Ixo8fn5x33nlJqVKlkqFDh2b6vfjii5nrdcwxxyTPPfdcMmrUqKRhw4bJ9ttvn6xevToz3h577JHUqVMn87fPy8vLd8233XbbpFu3bsk///nPZPz48cncuXOTJUuWJAMGDEgefPDBZNKkScnYsWOT888/PylVqlRy//3356u5UaNGSf/+/Qv8LdfdB/Pnz0/OOuusJCKSJ554IlPD0qVLk1mzZiURkdx1110FrkNEJLfddttGr9df/vKXJCKSo446KnnuueeSBx54IGnatGlSrVq15P3338+Mddlll2VqysvLSz788MP1jrexWteda/369ZNWrVolDzzwQDJu3LjkD3/4QxIRyZQpUzLjFPa+35B1982ZZ56ZjB07Nhk+fHiyzTbbJA0aNEi+/PLLTL8uXbokNWrUSBo0aJDccsstyYsvvpipo0uXLkmXLl0yfb/77rukWbNmSY0aNZLbbrstGTduXHLOOeckTZo0KfDcXn755cnP/29DYc/9vffeS0477bTk0UcfTSZPnpw8++yzyYknnpiUKlUqefHFF/ONGRHJ5ZdfvtFrkU3d/fv3T8qWLZs0btw4GTZsWPLCCy8k48aNS5IkSe64445k2LBhyTPPPJNMmTIluf/++5Oddtopad68ebJy5coC596oUaPkggsuSMaNG5fccMMNSaVKlZKdd945X9/CXpMNGTBgQHLPPfckEyZMSCZMmJBcddVVSYUKFfL9jmVznHfeeSepWLFi0qpVq2TUqFHJ008/nfTs2TNp2LBhEhHJ3LlzN1jLhx9+mBxxxBFJROT7rVi+fHmSJEnm92a33XZLHnvssWTMmDFJ165dkzJlyiQfffRRvhoK8xu2Iet+k9q2bZs88sgjyaRJk5K33367xK9XNs9kzZo1k+bNmyf33HNPMm7cuOSAAw5IIiK54oorkjZt2iSjRo1KxowZk+y+++5Jbm5u8tlnn230mnz++edJzZo1k4YNGyY
"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": [
"As we can see, there is a clear difference between the betweenness centrality of the networks generated from the checkins and the networks generated from the friendships. Since the values of the betweenness centrality of the networks generated from the checkins are higher than the theoretical values of a random network, we can conclude that the networks generated from the checkins are more likely to be a small-world network. On the other hand, the networks generated from the friendships have a lower value of betweenness centrality than the theoretical values of a random network, therefore we can conclude that the networks generated from the friendships are less likely to be a small-world network.\n",
"\n",
"This propriety appears both with the erdos-renyi and the watts-strogatz models."
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Clustering coefficient\n",
"\n",
"The simplest way to treat clustering analytically in a small-world network is to use the link addition, rather than the rewiring model. In the limit of large network size, $N \\to \\infty$, and for a fixed fraction of shortcuts $\\phi$, it is clear that the probability of forming triangle vanishes as we approach $1/N$, so the contribution of the shortcuts to the clustering is negligible. Therefore, the clustering of a small-world network is determined by its underlying ordered lattice. For example, consider a ring where each node is connected to its $k$ closest neighbors from each side. A node's number of neighbors is therefore $2k$, and thus it has $2k(2k - 1)/2 = k(2k - 1)$ pairs of neighbors. Consider a node, $i$. All of the $k$ nearest nodes on $i$'s left are connected to each other, and the same is true for the nodes on $i$'s right. This amounts to $2k(k - 1)/2 = k(k - 1)$ pairs. Now consider a node located $d$ places to the left of $k$. It is also connected to its $k$ nearest neighbors from each side. Therefore, it will be connected to $k - d$ neighbors on $i$'s right side. The total number of connected neighbor pairs is\n",
"\n",
"\\begin{equation}\n",
" k(k-1) + \\sum_{d=1}^k (k-d) = k(k-1) + \\frac{k(k-1)}{2} = \\frac{3}{2} k (k-1)\n",
"\\end{equation}\n",
"\n",
"and the clustering coefficient is:\n",
"\n",
"\\begin{equation}\n",
" C = \\frac{\\frac{3}{2}k(k-1)}{k(2k-1)} =\\frac{3 (k-1)}{2(2k-1)}\n",
"\\end{equation}\n",
"\n",
"For every $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 $3/4$, that is, the clustering is very high. Note that for a regular two-dimensional grid, the clustering by definition is zero, since no triangles exist. However, it is clear that the grid has a neighborhood structure.\n",
"\n",
"\n",
"--- \n",
"\n",
"We can compare the results of the clustering coefficient that we obtained with the standard formula, and the one that we obtained with the formula above. We can do that with the function `generalized_average_clustering_coefficient` in the `utils.py` file. The function takes as input a networkx graph object and returns a float: the average clustering coefficient of the graph."
]
},
{
"cell_type": "code",
"execution_count": 24,
"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": 25,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABcIAAAPdCAYAAACp3hugAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8o6BhiAAAACXBIWXMAAA9hAAAPYQGoP6dpAAC6X0lEQVR4nOzdebhd4/0/7tfOcDLIQGQQmRFDEFMaRA1BqKmilDatiJl8VImgah5jKlqtqWZFzakhDTGlSqho0CpKDKFJhBgiQUiyfn/45XwdJ4lzkhOH7b6va1/tftaz1nqvYa8tr7P2s0pFURQBAAAAAIAy1aC+CwAAAAAAgKVJEA4AAAAAQFkThAMAAAAAUNYE4QAAAAAAlDVBOAAAAAAAZU0QDgAAAABAWROEAwAAAABQ1gThAAAAAACUNUE4AAAAAABlTRAOQNn53e9+l1KplLXWWqu+S/lGmjdvXq677rpsvfXWadu2bRo3bpz27dtnxx13zF133ZV58+YlSV577bWUSqVcffXVS6WOyZMn56STTsrTTz+9VJZ/9dVXp1Qq5bXXXlsqy6+JZ599NnvvvXd69OiRpk2bpkWLFll//fVz9tln5913312q677pppuy5pprplmzZimVSpX7+cILL8wqq6ySioqKlEqlvP/++xkyZEi6d+9e63VsscUW2WKLLeq07i/7z3/+k5NOOmmpHMcHHnggffr0yTLLLJNSqZSRI0cusN+iztUhQ4akRYsWdV7b0nDSSSelVCot1rwPP/xwSqVSHn744bot6ku+jnNqafq2nA81vb4v6vO3xRZb+J6tY6VSKSeddFLl+6/rc/dlS3Kt+CaYX/8777xT36UA8A0jCAeg7Fx55ZVJkueeey5PPPFEPVfzzfLJJ59k++23z1577ZX27dvn4osvzoMPPphLLrkkK664Yn784x/nrrvu+lpqmTx5ck4++eSlFoTvsMMOGTduXDp27LhUlv9V/vjHP2aDDTbIk08+mSOPPDKjR4/OHXfckR//+Me55JJLsu+++y61db/99tvZc889s/LKK2f06NEZN25cVl111Tz99NM59NBD079//zz44IMZN25cWrZsmeOPPz533HFHrddz0UUX5aKLLloKW/D//Oc//8nJJ59c50F4URTZfffd07hx49x5550ZN25cNt988wX2Xdrn6tdlv/32y7hx4xZr3vXXXz/jxo3L+uuvX8dV8U22tD5/1IzPHQDUrUb1XQAA1KXx48fnmWeeyQ477JB77rknV1xxRTbccMOvtYaiKPLJJ5+kWbNmX+t6a2LYsGG59957c80112Tw4MFVpv3oRz/KkUcemY8//rieqqsbH3/8cZo2bZp27dqlXbt29VLDuHHjcvDBB2fAgAEZOXJkmjRpUjltwIABOeKIIzJ69Oiltv7//ve/+eyzz/Lzn/+8Srj73HPPJUn233//9O3bt7J95ZVXXqz19OrVa8kKrUeTJ0/Ou+++m1122SVbbbVVfZezVH300Udp3rx5OnfunM6dOy/WMlq1apWNNtqojiurH/OvEd/mO1755vvss89SKpXSqNHi/5O7nD53X1YX+wcAassd4QCUlSuuuCJJcuaZZ6Zfv37585//nI8++ijJ5//oat++ffbcc89q873//vtp1qxZhg0bVtk2Y8aMDB8+PD169EhFRUU6deqUww47LLNmzaoyb6lUyiGHHJJLLrkka6yxRpo0aZJrrrkmSXLyySdnww03TJs2bdKqVausv/76ueKKK1IURZVlzJ49O0cccURWWGGFNG/ePJtttlmeeuqpdO/ePUOGDKnSd+rUqTnwwAPTuXPnVFRUpEePHjn55JMzZ86cRe6bqVOn5vLLL8+2225bLQSfr2fPnundu/dCl7GwITQW9DPqW265JRtuuGFat26d5s2bZ6WVVso+++yT5POfe3/ve99Lkuy9994plUrVfhI+fvz4/PCHP0ybNm3StGnTrLfeern55purrGP+8Cf33Xdf9tlnn7Rr1y7NmzfP7NmzFzg0yvyf8j/55JPZdNNNK+s688wzK4eEme+5557LNttsk+bNm6ddu3b5v//7v9xzzz01+pn6GWeckVKplMsuu6xKCD5fRUVFfvjDH1a+nzdvXs4+++ysvvrqadKkSdq3b5/BgwfnzTffrDbv/fffn6222iqtWrVK8+bNs8kmm+SBBx6onD5kyJB8//vfT5LsscceKZVKlcNN/PznP0+SbLjhhimVSpXn1oKO67x583LhhRdm3XXXTbNmzbLssstmo402yp133lllf355GItPP/00p512WuW2tGvXLnvvvXfefvvtKv26d++eHXfcMaNHj87666+fZs2aZfXVV6/8RUfy+fH98Y9/nCTp379/5XnyVcM5/P3vf89WW22Vli1bpnnz5unXr1/uueeeyuknnXRSZSB89NFHp1QqLXRomJqcq0ny8ssvZ/vtt0+LFi3SpUuXHHHEEZk9e/Zi7ZuFufPOO7PxxhunefPmadmyZQYMGFDtDu/5n8V//vOf2W233bLccstV/qFjQZ/Tml57FjREw/xhQGqy7TW9FtZUTete1DXi5Zdfzt57752ePXumefPm6dSpU3baaaf861//qrKu+dv+pz/9KcOGDcsKK6yQZs2aZfPNN8+ECRMWWF9N9smC3HTTTdlmm23SsWPHNGvWLGussUZ+9atfVfveqc2+nzx5cnbfffe0bNkyrVu3zh577JGpU6d+ZS01/fzV5Hpa0+/TBSmKImeccUa6deuWpk2bpk+fPhkzZswCrz+1/d6+7rrrssYaa6R58+ZZZ511cvfdd1db/0svvZRBgwalffv2adKkSdZYY4384Q9/qNJn/jly3XXX5YgjjkinTp3SpEmTvPzyy3n77bczdOjQ9OrVKy1atEj79u2z5ZZb5pFHHvnKbf/y527+kDYLe33RV31XzHfPPfdk3XXXTZMmTdKjR4+ce+65X1nXfDU9NnWxf+Zv+9lnn53TTz89Xbt2rVzngrYrSd5666389Kc/TevWrdOhQ4fss88++eCDD2q8fQCUoQIAysRHH31UtG7duvje975XFEVRXH755UWS4uqrr67sc/jhhxfNmjUrPvjggyrzXnTRRUWS4tlnny2KoihmzZpVrLvuukXbtm2L8847r7j//vuL3/72t0Xr1q2LLbfcspg3b17lvEmKTp06Fb179y5uuOGG4sEHHyz+/e9/F0VRFEOGDCmuuOKKYsyYMcWYMWOKU089tWjWrFlx8sknV1n/T3/606JBgwbFr371q+K+++4rLrjggqJLly5F69ati7322quy35QpU4ouXboU3bp1Ky699NLi/vvvL0499dSiSZMmxZAhQxa5f2644YYiSXHxxRfXaH+++uqrRZLiqquuqmzba6+9im7dulXre+KJJxZf/M+Kxx57rCiVSsVPfvKTYtSoUcWDDz5YXHXVVcWee+5ZFEVRfPDBB8VVV11VJCmOO+64Yty4ccW4ceOKN954oyiKonjwwQeLioqKYtNNNy1uuummYvTo0cWQIUOq1TN/GZ06dSoOOOCA4q9//Wtx6623FnPmzKmc9uqrr1b233zzzYvll1++6NmzZ3HJJZcUY8aMKYYOHVokKa655prKfpMnTy6WX375omvXrsXVV19djBo1qthzzz2L7t27F0mKhx56aKH7bc6cOUXz5s2LDTfcsEb7uSiK4oADDiiSFIccckgxevTo4pJLLinatWtXdOnSpXj77bcr+1133XVFqVQqBg4cWNx+++3FXXfdVey4445Fw4YNi/vvv78oiqJ4+eWXiz/84Q9FkuKMM84oxo0bVzz33HPFc889Vxx33HGV+3DcuHHFyy+/vNDjuueeexalUqnYb7/9ir/85S/FX//61+L0008vfvvb31bZn5tvvnnl+7lz5xY/+MEPimWWWaY4+eSTizFjxhSXX3550alTp6JXr17FRx99VNm3W7duRefOnYtevXoV1157bXHvvfcWP/7xj4skxdixY4uiKIpp06YVZ5xxRpGk+MMf/lB5nkybNm2h+/Lhhx8uGjduXGywwQbFTTf
"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()\n"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"As we can see, for the graphs generated from the checkins, the two values are very similar. However, for the graphs generated from the friendships, the values are very different. This is another suggestion that the checkins graphs are more likely to be a small-world network than the friendships graphs. \n",
"\n",
"But this is not enough to jump to conclusions"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Conclusion: Omega coefficient\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": 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>omega-coefficient</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Brightkite Checkins Graph</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Gowalla Checkins Graph</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Foursquare Checkins Graph</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Brightkite Friendship Graph</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Gowalla Friendship Graph</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>Foursquare Friendship Graph</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Graph omega-coefficient\n",
"0 Brightkite Checkins Graph NaN\n",
"1 Gowalla Checkins Graph NaN\n",
"2 Foursquare Checkins Graph NaN\n",
"3 Brightkite Friendship Graph NaN\n",
"4 Gowalla Friendship Graph NaN\n",
"5 Foursquare Friendship Graph NaN"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"analysis_results[['Graph', 'omega-coefficient']]"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"To give you a better idea of how time consuming is this computation, I will report below the time that it took to compute the omega coefficient for the networks generated from all this networks:\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",
"Note that due to the small size of the friendships graphs, I have been able to compute the omega coefficent for the whole networks. However, for the checkins graphs, I had to take a 50% sample of the nodes. In both cases, I used `niter` and `nrand` equal to 3."
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"---\n",
"\n",
"This results are a bit of a surprise. The small-world coefficient (omega) measures how much a network is like a lattice or a random graph. Negative values mean the graph is similar to a lattice whereas positive values mean the graph is more random-like. Values close to 0 instead, should represent small-world characteristics.\n",
"\n",
"Based only on this metric, we may conclude that all the networks are small-worlds. In fact, all the values of the omega coefficient are ~$0.2$ (with the exception of the foursquare checkins graph, whose value is very close to $0$). However, I don't think this is the case. \n",
"\n",
"We have seen in the previous section that the $\\omega$ coefficient can be tricked by networks that have a very low clustering coefficient, and in my opinion this is exactly what is happening here. The networks generated from the friendships have a very low clustering coefficient, and therefore they are biasing the $\\omega$ coefficient. This conclusion is supported by the fact the measures like the betweenness centrality and the clustering coefficient that we have shown before, suggest that the networks generated from the friendships are not small-world networks. \n",
"\n",
"Furthermore, on a more heuristic level, those graphs represent a social network with data taken in 2010, a time when social networks were not as popular as they are today. Therefore, I would not be surprised if those networks are not small-worlds. \n",
"\n",
"On the other hand, on a more technical level, I think that using `niter` and `nrand` equal to $3$ is not enough to reach a definitive conclusion. However, choosing bigger values would have exponentially increased the time needed to compute the $\\omega$ coefficient and reducing the number of nodes in the sample would have reduced the accuracy of the results. \n",
"\n",
"---\n",
"\n",
"To summarize the work done: this study evidences why the characterization of the small-world propriety of a real-world network is still subject of debate. Even if we have used the most reliable techniques that the literature has to offer, we still have not been able to reach a definitive conclusion and specific observations on the single networks were necessary. For real networks, we still have not reached the completeness (in a metaphorical way, not topological) of the theoretical models firstly proposed in the 60s by Erdős and Rényi."
]
}
],
"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
}