aplbrain / grand

Your favorite Python graph libraries, scalable and interoperable. Graph databases in memory, and familiar graph APIs for cloud databases.
Apache License 2.0
80 stars 6 forks source link

Add default dialect #13

Closed Raphtor closed 3 years ago

Raphtor commented 3 years ago

In order to have drop-in compatibility with networkx, we could make the default dialect to be nx, such that graph.nx.{method} == graph.{method}. Duck test with nx digraph.

j6k4m8 commented 3 years ago

Ah, I think I see what you're saying. I think this is just syntax preference, right?

I usually do something like this:

my_grand_graph = grand.Graph(...)
G = my_grand_graph.nx

G now has all the networkx-flavored bells and whistles as your graph var above:

G.add_edge(1, 2)
len(G)

I've hesitated to add any API dialect at the "top level" like you illustrate above because it imposes some restrictions on how the user can use the package: (Why require a networkx install?) Does the graph = grand.Graph(...).nx solution solve this need?

Raphtor commented 3 years ago

Yeah that makes sense.