3 ms·
What you're saying is not true of the most popular graph package in Python (networkx). Graphs there are objects with attributes (edges, nodes, etc) and methods
by klyrs 4y ago
What you're saying is not true of the most popular graph package in Python (networkx). Graphs there are objects with attributes (edges, nodes, etc) and methods (add_edge, etc), but algorithms such as shortest paths are functions as you have called most natural: shortest_path(G, a, b)
- abdullahkhalids 4y agoWell, I am glad that at least this library is being functional, rather than object oriented. I wish all the others did as well.
- klyrs 4y agoIt's still object-oriented, though. The graphs themselves are objects, which helps with ergonomics. There are also functions that operate on graphs, because the alternative would be to stuff perhaps thousands of methods into the graph class -- which would be extremely annoying to maintain as well as abysmally slow.