Graphistry cuGraph bindings

Graphistry simplifies working with cuGraph. These codeblocks highlights:

  • Converting data between cpu/gpu dataframes and cuGraph
  • Enriching dataframes with cuGraph algorithm results
  • Visualization

Enriching Graphs with cuGraph

This section demonstrates how to enrich graphs using cuGraph's algorithm results and then visualizes these results:


    g2 = g.compute_cugraph('pagerank')
    g2._nodes.sample(5)

    g2.encode_point_color('pagerank', ['blue', 'yellow', 'red'], as_continuous=True).plot()

    g3b = g2.layout_cugraph('force_atlas2', params={'lin_log_mode': True})
    g3b._nodes.sample(5)

    g3.plot()

Converting between DataFrames and cuGraph

Here, we illustrate the conversion process between DataFrames and cuGraph:


    G = g3.to_cugraph()
    G.number_of_edges()

    g4 = graphistry.from_cugraph(G)

    {
        'edges': g4._edges.shape,
        'nodes': g4.materialize_nodes()._nodes.shape
    }

Utilizing cuGraph Layouts

In this section, we leverage cuGraph's implementation of the Force Atlas 2 layout algorithm. It's worth noting that Graphistry's default layout algorithm is already GPU-accelerated FA2 with additional configurations:


    g3 = g2.layout_cugraph('force_atlas2')
    g3._nodes.sample(5)