Raphtory
Raphtory copied to clipboard
Odd behaviour of property repr across layers in Python
Sometimes the printing of an edge has some incorrect behaviours when different layers are involved. Here is a small example
# event graph with two layers and properties
G = Graph()
G.add_edge(1, "A", "B", layer = "layer 1", properties={"greeting":"howdy"})
G.add_edge(2, "A", "B", layer = "layer 2", properties={"greeting":"yo"})
print(G.edge("A","B"))
print(G.edge("A","B").explode())
The first print gives
Edge(source=A, target=B, earliest_time=1, latest_time=2, properties={greeting: yo, greeting: yo}, layer(s)=[layer 1, layer 2])
Maybe greeting: yo and greeting: howdy would be reasonable or just greeting:yo if just the latest added property is displayed, but not two yos.
The second print looks correct:
Edges(Edge(source=A, target=B, earliest_time=1, latest_time=1, properties={greeting: howdy}, layer(s)=[layer 1]), Edge(source=A, target=B, earliest_time=2, latest_time=2, properties={greeting: yo}, layer(s)=[layer 2]))
Possible follow up is that if the latest property value for each layer is returned for a non-exploded edge, it could be shown as something like
Edge(source=A, target=B, earliest_time=1, latest_time=2, properties={greeting: howdy (layer layer 1), greeting: yo (layer layer 2}, layer(s)=[layer 1, layer 2])
so that it's clear where each property item is coming from.