amirouche
amirouche

Reputation: 7883

How to use networkx algorithm with my custom graph datastructure?

I have a graph database with a Gremlin query engine. I don't want to change that API. The point of the library is to be able to study graphs that can not fully stay in memory and maximize speed by not falling back to virtual memory.

The query engine is lazy, it will not fetch an edge or vertex until required or requested by the user. Otherwise it only use indices to traverse the graph.

Networkx has another API. What can I do to re-use networkx graph algorithm implementations with my graph?

Upvotes: 2

Views: 796

Answers (1)

Back2Basics
Back2Basics

Reputation: 7806

You are talking about extending your Graph API.

  • Hopefully the code translates from one implementation to another in which case copy-paste'ing from the algorithms section might work for you. (check the licenses first)
  • If you want to use existing code going forward you could make a middle layer or adapter class to help out with this.
  • If the source code doesn't line up then NetworkX has copious notes about the algorithms used and the underpinning mathematics at the bottom of the help pages and the code itself.

For the future: Maybe you could make it open source and get some traction with others who see the traversal engine as a good piece of engineering. In which case you would have help in maintaining/extending your work. Good Luck.

Upvotes: 1

Related Questions