removeAllEdges crash
ProudOfZiggy opened this issue · comments
Nikita Rodionov commented
Calling
public func removeAllEdges(from: V, to: V, bidirectional: Bool = true)
crashes at calling
public func removeAllEdges(from: Int, to: Int, bidirectional: Bool = true)
with fatal error: Index out of range
Nikita Rodionov commented
I think it's because you are removing elements from array in wrong way.
David Kopec commented
Hi @ProudOfZiggy,
Please provide sample code that causes the crash.
Nikita Rodionov commented
Here you go:
let graph = UnweightedGraph(vertices: ["1", "2", "3", "4", "5", "6"])
graph.addEdge(from: 0, to: 1, directed: false)
graph.addEdge(from: 1, to: 2, directed: false)
graph.addEdge(from: 2, to: 3, directed: false)
graph.addEdge(from: 3, to: 4, directed: false)
graph.addEdge(from: 4, to: 5, directed: false)
graph.removeAllEdges(from: "2", to: "3")
David Kopec commented
Thanks for reporting this issue. I'll submit a fix shortly.
Nikita Rodionov commented
Thank you. Will wait for a pods specs update.
David Kopec commented
Fixed in SwiftGraph 1.4.1