In the current version of the library (0.12), edge_subgraph(g::NamedGraph, es::AbstractVector) is returning incorrect results.
For instance the last assertion here fails.
using NamedGraphs
using NamedGraphs.NamedGraphGenerators: named_hexagonal_lattice_graph
using NamedGraphs: NamedEdge, edges
using NamedGraphs.GraphsExtensions: edge_subgraph
g = named_hexagonal_lattice_graph(3, 3)
#Ring of six edges in the graph
es = NamedEdge.([(1, 1) => (2, 1), (2, 1) => (3, 1), (3, 1) => (3, 2), (2, 2) => (3, 2), (1, 2) => (2, 2), (1, 1) => (1, 2)])
#They are all in `g` (and specified in the correct direction)
@assert all([e ∈ edges(g) for e in es])
#Build the subgraph from these edges
eg = edge_subgraph(g,es)
#But now one of them is missing from the subgraph they induce...
@assert length(edges(eg)) == length(es)
but passes on older versions of the library (0.7 for instance).
This appears to be due to the fact that internally in edge_subgraph the call to _g = subgraph(g, vs) builds a subgraph with edges that may be defined in reverse compared to the original graph g and then the edge subgraph is built by removing a setdiff(edges(g), es) from _g which cares about edge directionality.
In the current version of the library (0.12),
edge_subgraph(g::NamedGraph, es::AbstractVector)is returning incorrect results.For instance the last assertion here fails.
but passes on older versions of the library (0.7 for instance).
This appears to be due to the fact that internally in
edge_subgraphthe call to_g = subgraph(g, vs)builds a subgraph with edges that may be defined in reverse compared to the original graphgand then the edge subgraph is built by removing asetdiff(edges(g), es)from_gwhich cares about edge directionality.