NetworkX

NetworkX#

NetworkX is an early graph manipulation library with a variety of algorithms and layouts.

[1]:
import graphistry

# To specify Graphistry account & server, use:
# graphistry.register(api=3, username='...', password='...', protocol='https', server='hub.graphistry.com')
# For more options, see https://github.com/graphistry/pygraphistry#configure

import networkx as nx
import pandas as pd
[2]:
G = nx.Graph()
G.add_nodes_from([
    (1, {"v": "one"}),
    (2, {"v": "two"}),
    (3, {"v": "three"}),
    (4, {"v": "four"}),
    (7, {"v": "seven"}),
    (8, {"v": "eight"})])
G.add_edges_from([
    [2,3],
    [3,4],
    [7,8]])
graphistry.bind(source='src', destination='dst', node='nodeid').plot(G)
[2]:

When manipulating the graph, this form is even easier, as you can then use PyGraphistry methods for tasks like filtering, algorithmic enrichment, GFQL queries, etc:

[ ]:
g = graphistry.bind().from_networkx(G)

assert isinstance(g._edges, pd.DataFrame)
assert isinstance(g._nodes, pd.DataFrame)

g._edges