Common igraph issues
While igraph is a powerful library for graph data and its analysis, much of its power comes from the fact that Python acts as an interface to igraph’s implementation behind the scenes, which is in C. Because of this, igraph comes with some quirks, which you need to bear in mind when using its features. In the following subsections we will take you through some common problems users come across when working with igraph in Python.
No nodes in the graph
Some graph and network science libraries in Python can be created directly from a list of tuples, an edgelist. In igraph, because of how node indexing is implemented in C, nodes have to be added to a Graph
object before edges can connect them together. In the next steps, we will demonstrate this problem and the subsequent errors that arise:
- We can first read in edge data from
musae_git_edges.csv
as our example graph to load into igraph, using the inbuiltcsv
module. This file has headers, so we...