filmov
tv
Python Tutorial : Network visualization

Показать описание
---
You may have seen node-link diagrams involving more than a hundred thousand nodes.
They purport to show a visual representation of the network, but in reality just show a hairball. In this section, we are going to look at alternate ways of visualizing network data that are much more rational.
I’m going to introduce to you three different types of network visualizations. The first is visualizing a network using a Matrix Plot. The second is what we call an “Arc Plot”, and the third is called “Circos Plot”.
Let’s start first with a Matrix Plot.
In a Matrix Plot, nodes are the rows and columns of a matrix, and cells are filled in according to whether an edge exists between the pairs of nodes. On these slides, the left matrix is the matrix plot of the graph on the right.
In an undirected graph, the matrix is symmetrical around the diagonal, which I’ve highlighted in grey. I’ve also highlighted one edge in the toy graph, edge (A, B), which is equivalent to the edge (B, A).
Likewise for edge (A, C), it is equivalent to the edge (C, A), because there’s no directionality associated with it.
If the graph were a directed graph, then the matrix representation is not necessarily going to be symmetrical. In this example, we have a bidirectional edge between A and C, but only an edge from A to B and not B to A. Thus, we will have (A, B) filled in, but not (B, A).
If the nodes are ordered along the rows and columns such that neighbours are listed close to one another, then a matrix plot can be used to visualize clusters, or communities, of nodes.
Let’s now move on to Arc Plots.
An Arc Plot is a transformation of the node-link diagram layout, in which nodes are ordered along one axis of the plot, and edges are drawn using circular arcs from one node to another. If the nodes are ordered according to some some sortable rule, e.g. age in a social network of users, or otherwise grouped together, e.g. by geographic location in map for a transportation network, then it will be possible to visualize the relationship between connectivity and the sorted (or grouped) property.
Arc Plots are a good starting point for visualizing a network, as it forms the basis of the later plots that we’ll take a look at.
Let’s now move on to Circos Plots.
A CircosPlot is a transformation of the ArcPlot, such that the two ends of the ArcPlot are joined together into a circle.
Circos Plots were originally designed for use in genomics, and you can think of them as an aesthetic and compact alternative to Arc Plots.
You will be using a plotting utility that I developed called nxviz. Here’s how to use it.
The code example here shows you how to create an Arc Plot using nxviz, and you’ll get a chance to play around with the other plots in the exercises.
Alright! Let’s get hacking!
#DataCamp #PythonTutorial #NetworkAnalysisinPython