Skip to content

docs: fix README breadth-first search example - #94

Merged
davecom merged 1 commit into
davecom:masterfrom
dajiaohuang:docs/fix-readme-search-example-20261016
Oct 18, 2026
Merged

davecom merged 1 commit into
davecom:masterfrom
dajiaohuang:docs/fix-readme-search-example-20261016

Conversation

@dajiaohuang

Copy link
Copy Markdown
Contributor

Summary

Fix the README's breadth-first search example and matching API overview to use findAllBfs(from:goalTest:), the method currently provided by Graph. Also replace String.characters.first with String.first, since characters is unavailable in the documented Swift 5-and-later environment.

At master 6c5fb8828d056de4c9f922662748589ede201eff, compiling the example reports that WeightedGraph<String, Int> has no member findAll. After correcting the method name, compilation also reports that characters is unavailable. The corrected snippet compiles and returns the expected matching route on a two-vertex fixture.

Validation

  • Swift 6.0.3, Ubuntu 24.04: swift build --jobs 1 passes.
  • External SwiftPM consumer with a local package dependency: the README search snippet fails before these changes and compiles/runs after them.
  • Additional self-authored graphs (at most five vertices): directed/undirected BFS/DFS, weighted directed/undirected shortest paths, MST, Codable roundtrips, collection access, and cycle/DAG API smoke checks pass.
  • git diff --check passes.

No library behavior changes. The complete upstream test suite and performance tests were not run; local fixtures were intentionally limited to tiny graphs. macOS/Xcode, CocoaPods, Carthage, and the sample macOS app were not validated here.

@davecom
davecom merged commit b57b2e4 into davecom:master Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants