LightGraphs.jl icon indicating copy to clipboard operation
LightGraphs.jl copied to clipboard

Preserve vertex labels after deleting a vertex.

Open rachithaiyappa opened this issue 3 years ago • 1 comments

https://github.com/JuliaGraphs/LightGraphs.jl/blob/ddaf3d37aed00b2b22705376bd79fba2c4bb6363/src/SimpleGraphs/SimpleGraphs.jl#L124-L153

The documentation says node labels (indices) are lost when a node is removed from the graph. Perhaps it might be helpful to have an option to preserve it?

rachithaiyappa avatar Aug 25 '21 19:08 rachithaiyappa

The internal structure of the SimpleGraph maintains the vertices to a compact range starting from 1. This is part of the API contract of a SimpleGraph, and some algorithms may use this property. So we can't change it as we would not know which algorithms would break.

etiennedeg avatar Aug 26 '21 07:08 etiennedeg