Skip to content

MinimumSpanningTree#1409

Open
pramsey wants to merge 8 commits intolibgeos:mainfrom
pramsey:main-spanning-tree
Open

MinimumSpanningTree#1409
pramsey wants to merge 8 commits intolibgeos:mainfrom
pramsey:main-spanning-tree

Conversation

@pramsey
Copy link
Copy Markdown
Member

@pramsey pramsey commented Mar 24, 2026

Given a set of curves, form a graph using coincident start/end points as the nodes. Kruskal algorithm calculates the shortest set of edges that connect every node in the graph. Exposed in CAPI as GEOSMinimumSpanningTree. This feature was built with the help of Gemini.

Comment thread src/operation/spanning/SpanningTree.cpp
Comment thread capi/geos_c.h.in
*
* \param geoms Input array of Curves. Non-Curve geometries are ignored.
* \param ngeoms Number of geometries in the input array.
* \return An array of size_t of size ngeoms. 0 if the edge is not in the MST.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semantics are somewhat different from the clustering functions, does it make sense to return a GEOSClusterInfo* ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went back and forth on that... functionally it's doing the thing I want, so maybe it's the right answer slightly off-kilter naming be damned. Was is your feel?

@dbaston dbaston added the Enhancement New feature or feature improvement. label Apr 13, 2026
@dbaston dbaston added this to the 3.15.0 milestone Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or feature improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants