Pometry / Raphtory

Scalable graph analytics database powered by a multithreaded, vectorized temporal engine, written in Rust
https://raphtory.com
GNU General Public License v3.0
344 stars 54 forks source link

Possible improvements for interaction with edge properties in to_networkx #1576

Open narnolddd opened 6 months ago

narnolddd commented 6 months ago

Currently if you have a raphtory graph with edge properties and map it to a networkx graph, the properties are in a new map with keys "constant" or "temporal". Upon selecting temporal, the value of each is returned as a list of k,v tuples rather than a dict which makes accessing the value of one property a bit clunky, e.g. if you call g.edges.data("temporal") it might look like this for one edge.

('node_a', 'node_b', [('boolean_prop', [(1465088400000, True)])])

Could this be changed to be a dict? I.e.

('node_a', 'node_b', {'boolean_prop' : [(1465088400000, True)]})

Even better, I believe the old version of to_networkx (when it was in python before rust), when you set explode_edges to true would return multiple edges each with just one flat property with that name, so that upon calling g.edges.data("boolean_prop") it would return something like

('node_a', 'node_b', (1465088400000, True))

since each exploded edge has just one temporal property update. Would it be possible to have something like this again?

Happy to expand or help make the fix :)

miratepuffin commented 6 months ago

The second part is still possible, but we can certainly turn the internal type into a dict, I think that makes sense!

image