Raphtory
Raphtory copied to clipboard
Unique function for properties
Need to add a new function in the properties API which removes any duplicates from 'items' keeping the earliest/latest time
unique(esarliest_time)
: should return the earliest entries for open
, review
and in-progress
unique(latest_time)
: should return the latest entries for open
, review
and in-progress
g = PersistentGraph()
g.add_edge(1,1,2,properties={“status”:“open”})
g.add_edge(2,1,2,properties={“status”:“open”})
g.add_edge(3,1,2,properties={“status”:“review”})
g.add_edge(4,1,2,properties={“status”:“open”})
g.add_edge(5,1,2,properties={“status”:“in-progress”})
g.add_edge(10,1,2,properties={“status”:“in-progress”})
g.add_edge(6,1,2)
assert g.edge(1,2).properties.temporal.get(“status”).unique() == [“open”, “review”, “in-progress”]
assert g.edge(1,2).properties.temporal.get(“status”).ordered_deduple(latest_time=True) == [(2,“open”), (3“review”), (4,“open”), (10, “in-progress”)]
assert g.edge(1,2).properties.temporal.get(“status”).ordered_deduple(latest_time=False) == [(1,“open”), (3“review”), (4,“open”), (5, “in-progress”)]