Hi,
I just discovered some unexpected behaviour when converting a MetaDiGraph to MetaGraph. In my MetaDiGraph I have one edge that is directed from a high number to a lower number, i.e. 3->2 instead of 2->3. When I convert the MetaDiGraph to a MetaGraph the property is lost on the edge directed in the "wrong" direction, but on another edge directed in the opposite direction the property is kept.
Would it maybe make more sense if the property was kept for both edges?
Below is a code example demonstrating the behaviour.
using LightGraphs
using MetaGraphs
G = MetaDiGraph(3)
add_edge!(G, 1, 2)
add_edge!(G, 3, 2)
set_prop!(G, 1, 2, :name, "a")
set_prop!(G, 3, 2, :name, "b")
Confirm that the property was correctly set.
Convert the directed graph to an undirected graph.
Check that the property on the first edge is still there.
get_prop(G2, 1, 2, :name)
Try to get the property of the second edge.
get_prop(G2, 3, 2, :name)
KeyError: key :name not found
Stacktrace:
[1] getindex at .\dict.jl:477 [inlined]
[2] get_prop at C:\Users\user\.julia\packages\MetaGraphs\SUjFO\src\MetaGraphs.jl:256 [inlined]
[3] get_prop(::MetaGraph{Int64,Float64}, ::Int64, ::Int64, ::Symbol) at C:\Users\user\.julia\packages\MetaGraphs\SUjFO\src\MetaGraphs.jl:258
[4] top-level scope at In[10]:1
Try to get the property with inversed vertex order
get_prop(G2, 2, 3, :name)
KeyError: key :name not found
Stacktrace:
[1] getindex at .\dict.jl:477 [inlined]
[2] get_prop at C:\Users\user\.julia\packages\MetaGraphs\SUjFO\src\MetaGraphs.jl:256 [inlined]
[3] get_prop(::MetaGraph{Int64,Float64}, ::Int64, ::Int64, ::Symbol) at C:\Users\user\.julia\packages\MetaGraphs\SUjFO\src\MetaGraphs.jl:258
[4] top-level scope at In[11]:1
Check if the edge is in the graph
Hi,
I just discovered some unexpected behaviour when converting a MetaDiGraph to MetaGraph. In my MetaDiGraph I have one edge that is directed from a high number to a lower number, i.e. 3->2 instead of 2->3. When I convert the MetaDiGraph to a MetaGraph the property is lost on the edge directed in the "wrong" direction, but on another edge directed in the opposite direction the property is kept.
Would it maybe make more sense if the property was kept for both edges?
Below is a code example demonstrating the behaviour.
Confirm that the property was correctly set.
Convert the directed graph to an undirected graph.
Check that the property on the first edge is still there.
Try to get the property of the second edge.
Try to get the property with inversed vertex order
Check if the edge is in the graph