Book Image

Network Science with Python and NetworkX Quick Start Guide

By : Edward L. Platt
Book Image

Network Science with Python and NetworkX Quick Start Guide

By: Edward L. Platt

Overview of this book

NetworkX is a leading free and open source package used for network science with the Python programming language. NetworkX can track properties of individuals and relationships, find communities, analyze resilience, detect key network locations, and perform a wide range of important tasks. With the recent release of version 2, NetworkX has been updated to be more powerful and easy to use. If you’re a data scientist, engineer, or computational social scientist, this book will guide you in using the Python programming language to gain insights into real-world networks. Starting with the fundamentals, you’ll be introduced to the core concepts of network science, along with examples that use real-world data and Python code. This book will introduce you to theoretical concepts such as scale-free and small-world networks, centrality measures, and agent-based modeling. You’ll also be able to look for scale-free networks in real data and visualize a network using circular, directed, and shell layouts. By the end of this book, you’ll be able to choose appropriate network representations, use NetworkX to build and characterize networks, and uncover insights while working with real-world systems.
Table of Contents (15 chapters)

To get the most out of this book

This book assumes very little previous knowledge—only a familiarity with the fundamentals of programming. Knowledge of the Python programming language is helpful for understanding the examples, but for readers only familiar with other programming languages, the code comments and descriptions should not be too difficult to understand.

The examples in this book can be run in any Python environment with access to the required libraries, but Jupyter Lab is recommended and offers several benefits. Jupyter Lab is an interactive programming environment for Python and other languages. Jupyter Lab runs in a web browser and makes it possible to visualize outputs along with the code, as well as to easily modify and re-run chunks of code.

Download the example code files

You can download the example code files for this book from your account at www.packt.com. If you purchased this book elsewhere, you can visit www.packt.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

  1. Log in or register at www.packt.com.
  2. Select the SUPPORT tab.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box and follow the onscreen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR/7-Zip for Windows
  • Zipeg/iZip/UnRarX for Mac
  • 7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Network-Science-with-Python-and-NetworkX-Quick-Start-Guide. In case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "Mount the downloaded WebStorm-10*.dmg disk image file as another disk in your system."

A block of code is set as follows:

G_karate = nx.karate_club_graph()
mr_hi = 0
john_a = 33

When code produces text output, that text output is set in bold:

list(nx.all_shortest_paths(G_karate, mr_hi, john_a))
[[0, 8, 33], [0, 13, 33], [0, 19, 33], [0, 31, 33]]

Bold: Indicates a new term or an important word. For example: "Statements that refer to themselves are called self-referential."

Warnings or important notes appear like this.
Tips and tricks appear like this.