You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The way the squash is currently implemented is by either calling SimpleGraph{T}(g) or SimpleDiGraph{T}(g) for some integer type T. This fails if g is a subtype of AbstractGraph for which these functions are not implemented. There are multiple ways to solve this:
Restrict squash to SimpleGraph and SimpleDiGraph and leave the implementation of that function for other graph types open.
Ensure that the constructors SimpleGraph{T}(g) or SimpleDiGraph{T}(g) work for for any kind of g::AbstractGraph.
Require that subtypes of any kind of graph type SomeGraph <: AbstractGraph implement a constructor SomeGraph{T}(g) and adjust squash accordingly.
In my opinion, 1. is the way to go. 2. could lead to some information (such as metadata) being thrown away by squash which is probably not what the user wants. 3. would make the interface more complicated and would make existing packages not correspond to the interface anymore.
The text was updated successfully, but these errors were encountered:
I also think 1. is the way to go. It should nonetheless be possible to implement a conversion from AbstractGraph to SimpleGraph by collecting neighbors.
or with a different function name, to keep the number of constructs a bit low. We would also need to figure out what to do in cases when the argument is a directed graph. Currently there is already a constructor SimpleGraph(::SimpleDiGraph) which adds an undirected edge, if there is one edge in either direction in the directed graph.
The way the
squash
is currently implemented is by either callingSimpleGraph{T}(g)
orSimpleDiGraph{T}(g)
for some integer typeT
. This fails ifg
is a subtype ofAbstractGraph
for which these functions are not implemented. There are multiple ways to solve this:squash
toSimpleGraph
andSimpleDiGraph
and leave the implementation of that function for other graph types open.SimpleGraph{T}(g)
orSimpleDiGraph{T}(g)
work for for any kind ofg::AbstractGraph
.SomeGraph <: AbstractGraph
implement a constructorSomeGraph{T}(g)
and adjustsquash
accordingly.In my opinion, 1. is the way to go. 2. could lead to some information (such as metadata) being thrown away by
squash
which is probably not what the user wants. 3. would make the interface more complicated and would make existing packages not correspond to the interface anymore.The text was updated successfully, but these errors were encountered: