Python Bindings
Next, we illustrate how to use GBBS from Python using the python bindings we provide (through pybind11)
Extending the Python bindings after implementing a new benchmark requires only a few lines of code to add an extra method to the graph object exported by the library. Note that the contents of this file have been tested using Python 3.7.6. You may run into issues using an earlier version.
We first build the bindings using Bazel and add the compiled libraries to the Python path:
#
Loading SNAP GraphsLaunch the Python REPL, import the library, and import a downloaded graph from the SNAP dataset.
This command creates an uncompressed graph in the GBBS format at the same location as the input (compression can optionally be enabled using a separate flag).
#
Loading Graphs in the Adjacency Array FormatWe also provide commands to load graphs that have already been created in some valid format.
To load a graph in text format:
To load a graph in compressed format:
To load a graph in the binary format:
#
Running Graph AlgorithmsWe can then apply the methods defined on graphs as follows:
Other primitives can be applied similarly. For example: