Reader small image

You're reading from  Network Science with Python and NetworkX Quick Start Guide

Product typeBook
Published inApr 2019
Reading LevelIntermediate
PublisherPackt
ISBN-139781789955316
Edition1st Edition
Languages
Concepts
Right arrow
Author (1)
Edward L. Platt
Edward L. Platt
author image
Edward L. Platt

Edward L. Platt creates technology for communities and communities for technology. He is currently a researcher at the University of Michigan School of Information and the Center for the Study of Complex Systems. He has published research on large-scale collective action, social networks, and online communities. He was formerly a staff researcher at the MIT Center for Civic Media. He contributes to many free/open source software projects, including tools for media analysis, network science, and cooperative organizations. He has also done research on quantum computing and fault tolerance. He has an M.Math in Applied Mathematics from the University of Waterloo, as well as B.S degrees in both Computer Science and Physics from MIT.
Read more about Edward L. Platt

Right arrow

Appendix

The branch of mathematics studying networks is called graph theory. Graph and network are more or less two words for the same thing, but mathematicians can be picky about exact definitions. A graph is composed of two parts: a set of things called vertices and a set of edges representing connections between those vertices.

What is a vertex? It's a mathematical object whose sole purpose is to be connected to other vertices. In other words, it's pretty much the same thing as a node. In order to tell vertices apart, it is necessary to give them some kind of label. These labels could be anything, but let's call them v1, v2, and so on. It's a common convention to call a set of vertices V. Mathematically, this can be written using the following set notation, where N is the number of vertices in V:

V = {v1, v2, ..., vN},

Connections between vertices are called...

Adjacency matrices

A matrix is a way of describing pairwise relationships. A matrix looks like a grid of numbers, as in the following example:

┌           ┐
│ 0 1 42 │
│ 0.5 -3 1 │
└ ┘

The preceding matrix contains six entries, organized in two rows and three columns. A matrix can have any number of rows or columns, but they are always rectangular. A matrix with two rows and three columns is described as a 2 x 3 matrix. If the entire matrix is called A, then the element at row i and column j is called Ai,j. So, in the preceding example, A2,1 = 0.5.

One way to represent a graph as a matrix is to place the weight of each edge in one element of the matrix (or a zero if there is no edge). So, an edge from v3, to v1 with a weight of 37 would be represented by A3,1 = 37, meaning the third row has a 37 in the first column...

Biadjacency matrices

Bipartite graphs can be represented using another type of matrix. Bipartite graphs have two types of vertices, which I'll call row-vertices and column-vertices, for reasons that will become obvious. All edges connect one row-vertex to one column-vertex, so it's not necessary to use a full adjacency matrix connecting all possible vertex pairs. Instead, we represent the edge from the ith row-vertex to the jth column-vertex by setting the element of the matrix at row i and column j. This type of matrix is called a biadjacency matrix, and is typically denoted as B. Because the number of row vertices and column vertices can be different, the biadjacency matrix does not need to be square. The bipartite graph can be projected into a graph containing only row-nodes (or only column-nodes) by using simple matrix operations.

...

Modularity

As an example of how math is used in network science, several popular community detection algorithms (including those discussed in Chapter 7, In-Between – Communities) work by maximizing a mathematical property called modularity. Modularity is the difference between the fraction of internal edges and how many you'd expect if edges were assigned randomly (without changing vertex degrees).

Let's assume an undirected network. Given a set of vertex labels c, with corresponding vertex degrees ki for i∊c, the expected fraction of internal edges can be approximately written as follows:

i∊cj∊c kikj / (2 |E|)2,

Here, |E| is the total number of edges. The true number of edges between vertices i and j is given by element Ai,j of the adjacency matrix. Summing over all communities c in partition C, the modularity Q, can be written...

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Network Science with Python and NetworkX Quick Start Guide
Published in: Apr 2019Publisher: PacktISBN-13: 9781789955316
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Edward L. Platt

Edward L. Platt creates technology for communities and communities for technology. He is currently a researcher at the University of Michigan School of Information and the Center for the Study of Complex Systems. He has published research on large-scale collective action, social networks, and online communities. He was formerly a staff researcher at the MIT Center for Civic Media. He contributes to many free/open source software projects, including tools for media analysis, network science, and cooperative organizations. He has also done research on quantum computing and fault tolerance. He has an M.Math in Applied Mathematics from the University of Waterloo, as well as B.S degrees in both Computer Science and Physics from MIT.
Read more about Edward L. Platt