NetworkX Overview

Learn how the NetworkX library is structured and some of its functions and algorithms.

Let’s formally introduce some of NetworkX’s structures and main functionalities.

Graph types

Every graph we create with NetworkX has a type associated with it. There are a total of four graph types we can represent:

  • Graph: This is the default undirected graph.

  • DiGraph: This is a default and directed graph.

  • MultiGraph: This is an undirected multigraph.

  • MultiDiGraph: This is a directed multigraph.

A MultiGraph is a graph where we can have more than one edge connecting the same two nodes, such as the following: in this case, besides being a MultiGraph, it is also directed, so we can see the edges have a direction.

Get hands-on with 1400+ tech skills courses.