Skip to content

Commit e42bc19

Browse files
committed
fixed a warning, updated a couple license headers, removed .swift-version, updated version in podfile, updated docs/changelog/contributors for 3.1
1 parent f3eb766 commit e42bc19

File tree

13 files changed

+53
-20
lines changed

13 files changed

+53
-20
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ DerivedData
2929
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
3030
#
3131
# Pods/
32+
.swiftpm/

.swift-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
### 3.1
2+
- Reverse a graph with `reversed()` (@mattpaletta)
3+
- Performance improvement to `topologicalSort()` (@dabbott)
4+
- Recursive initializers for `UniqueElementsGraph` (@ferranpujolcamins)
5+
- A few `let` vs `var` warnings fixed
6+
17
### 3.0.0
28
- **This is an API breaking refactor**
39
- This version requires Swift 5.0 (Xcode 10.2)

CONTRIBUTORS.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ SwiftGraph is being used in several real-world and hobby projects. The most nota
1414

1515
SwiftGraph has been worked on by the following people:
1616
- David Kopec (@davecom) - I started the project in 2014 and I have been maintaining it ever since; I wrote most of the code between 2014-2017
17-
- Ferran Pujol Camins (@ferranpujolcamins) - Ferran got us setup with continuous integration, added the `UniqueVerticesGraph` class and its supporting machinery, refactored some of the search algorithms, cleaned up several miscellaneous sections, and is working on Graphviz support. He has been the primary force behind SwiftGraph in 2018-2019.
18-
- Zev Eisenberg (@ZevEisenberg) - Added the original cycle detection algorithms.
17+
- Ferran Pujol Camins (@ferranpujolcamins) - Ferran got us setup with continuous integration, added the `UniqueVerticesGraph` class and its supporting machinery, refactored some of the search algorithms, cleaned up several miscellaneous sections, and is working on Graphviz support. He was the primary force behind SwiftGraph in 2018-2019.
18+
- Zev Eisenberg (@ZevEisenberg) - Added the original cycle detection algorithms and provided miscellaneous bug fixes.
1919
- Kevin Lundberg (@klundberg) - Added Carthage support.
2020
- Ian Grossberg (@yoiang) - Helped with Codable support
21+
- Devin Abbott (@dabbott) - Improved the performance of `topologicalSort()`
22+
- Matt Paletta (@mattpaletta) - Added `reversed()`
2123

2224
Thank you to everyone who has contributed, including those not listed, who made smaller contributions. If I forgot you and you made a significant contribution to SwiftGraph, please make a pull request to this document.
2325

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313

1414
SwiftGraph is a pure Swift (no Cocoa) implementation of a graph data structure, appropriate for use on all platforms Swift supports (iOS, macOS, Linux, etc.). It includes support for weighted, unweighted, directed, and undirected graphs. It uses generics to abstract away both the type of the vertices, and the type of the weights.
1515

16-
It includes copious in-source documentation, unit tests, as well as search functions for doing things like breadth-first search, depth-first search, and Dijkstra's algorithm. Further, it includes utility functions for topological sort, Jarnik's algorithm to find a minimum-spanning tree, detecting a DAG (directed-acyclic-graph), and enumerating all cycles.
16+
It includes copious in-source documentation, unit tests, as well as search functions for doing things like breadth-first search, depth-first search, and Dijkstra's algorithm. Further, it includes utility functions for topological sort, Jarnik's algorithm to find a minimum-spanning tree, detecting a DAG (directed-acyclic-graph), enumerating all cycles, and more.
1717

1818
## Installation
1919

20-
SwiftGraph 3.0 requires Swift 5 (Xcode 10.2). Use SwiftGraph 2.0 for Swift 4.2 (Xcode 10.1) support, SwiftGraph 1.5.1 for Swift 4.1 (Xcode 9), SwiftGraph 1.4.1 for Swift 3 (Xcode 8), SwiftGraph 1.0.6 for Swift 2 (Xcode 7), and SwiftGraph 1.0.0 for Swift 1.2 (Xcode 6.3) support. SwiftGraph supports GNU/Linux and is tested on it.
20+
SwiftGraph 3.0 and above requires Swift 5 (Xcode 10.2). Use SwiftGraph 2.0 for Swift 4.2 (Xcode 10.1) support, SwiftGraph 1.5.1 for Swift 4.1 (Xcode 9), SwiftGraph 1.4.1 for Swift 3 (Xcode 8), SwiftGraph 1.0.6 for Swift 2 (Xcode 7), and SwiftGraph 1.0.0 for Swift 1.2 (Xcode 6.3) support. SwiftGraph supports GNU/Linux and is tested on it.
2121

2222
### CocoaPods
2323

@@ -28,7 +28,7 @@ Use the CocoaPod `SwiftGraph`.
2828
Add the following to your `Cartfile`:
2929

3030
```
31-
github "davecom/SwiftGraph" ~> 3.0.0
31+
github "davecom/SwiftGraph" ~> 3.1
3232
```
3333

3434
### Swift Package Manager (SPM)
@@ -171,6 +171,8 @@ An extension to `WeightedGraph` in `MST.swift` can find a minimum-spanning tree
171171
An extension to `Graph` in `Cycles.swift` finds all of the cycles in a graph.
172172
* `detectCycles()` - Uses an algorithm developed by Liu/Wang to find all of the cycles in a graph. Optionally, this method can take one parameter, `upToLength`, that specifies a length at which to stop searching for cycles. For instance, if `upToLength` is 3, `detectCycles()` will find all of the 1 vertex cycles (self-cycles, vertices with edges to themselves), and 3 vertex cycles (connection to another vertex and back again, present in all undirected graphs with more than 1 vertex). There is no such thing as a 2 vertex cycle.
173173

174+
An extension to `Graph` in `Reversed.swift` reverses all of the edges in a graph.
175+
174176
## Authorship, License, & Contributors
175177
SwiftGraph is written by David Kopec and other contributors (see `CONTRIBUTORS.md`). It is released under the Apache License (see `LICENSE`). You can find my email address on my GitHub profile page. I encourage you to submit pull requests and open issues here on GitHub.
176178

Sources/SwiftGraph/Reversed.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,18 @@
33
// SwiftGraph
44
//
55
// Created by Matthew Paletta on 2021-02-18.
6-
// Copyright © 2021 Oak Snow Consulting. All rights reserved.
76
//
7+
// Licensed under the Apache License, Version 2.0 (the "License");
8+
// you may not use this file except in compliance with the License.
9+
// You may obtain a copy of the License at
10+
//
11+
// http://www.apache.org/licenses/LICENSE-2.0
12+
//
13+
// Unless required by applicable law or agreed to in writing, software
14+
// distributed under the License is distributed on an "AS IS" BASIS,
15+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
// See the License for the specific language governing permissions and
17+
// limitations under the License.
818

919
import Foundation
1020

Sources/SwiftGraph/Sort.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public extension Graph {
3434
var notDAG = false
3535

3636
// Determine vertex neighbors in advance, so we have to do it once for each node.
37-
var neighbors: [Set<Int>] = rangeOfVertices.map({ index in
37+
let neighbors: [Set<Int>] = rangeOfVertices.map({ index in
3838
Set(edges[index].map({ $0.v }))
3939
})
4040

SwiftGraph.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'SwiftGraph'
3-
s.version = '3.0.0'
3+
s.version = '3.1'
44
s.license = { :type => "Apache License, Version 2.0", :file => "LICENSE" }
55
s.summary = 'A Graph Data Structure in Pure Swift'
66
s.homepage = 'https://github.com/davecom/SwiftGraph'

SwiftGraph.xcodeproj/project.pbxproj

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@
442442
attributes = {
443443
LastSwiftMigration = 0710;
444444
LastSwiftUpdateCheck = 0820;
445-
LastUpgradeCheck = 1100;
445+
LastUpgradeCheck = 1240;
446446
ORGANIZATIONNAME = "Oak Snow Consulting";
447447
TargetAttributes = {
448448
55E620011A194C80000A5F7B = {
@@ -640,6 +640,7 @@
640640
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
641641
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
642642
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
643+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
643644
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
644645
CLANG_WARN_STRICT_PROTOTYPES = YES;
645646
CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -663,13 +664,13 @@
663664
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
664665
GCC_WARN_UNUSED_FUNCTION = YES;
665666
GCC_WARN_UNUSED_VARIABLE = YES;
666-
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
667+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
667668
MACOSX_DEPLOYMENT_TARGET = 10.10;
668669
MTL_ENABLE_DEBUG_INFO = YES;
669670
ONLY_ACTIVE_ARCH = YES;
670671
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
671672
SWIFT_VERSION = 5.0;
672-
TVOS_DEPLOYMENT_TARGET = 9.0;
673+
TVOS_DEPLOYMENT_TARGET = 12.0;
673674
WATCHOS_DEPLOYMENT_TARGET = 2.0;
674675
};
675676
name = Debug;
@@ -698,6 +699,7 @@
698699
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
699700
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
700701
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
702+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
701703
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
702704
CLANG_WARN_STRICT_PROTOTYPES = YES;
703705
CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -715,11 +717,11 @@
715717
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
716718
GCC_WARN_UNUSED_FUNCTION = YES;
717719
GCC_WARN_UNUSED_VARIABLE = YES;
718-
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
720+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
719721
MACOSX_DEPLOYMENT_TARGET = 10.10;
720722
MTL_ENABLE_DEBUG_INFO = NO;
721723
SWIFT_VERSION = 5.0;
722-
TVOS_DEPLOYMENT_TARGET = 9.0;
724+
TVOS_DEPLOYMENT_TARGET = 12.0;
723725
WATCHOS_DEPLOYMENT_TARGET = 2.0;
724726
};
725727
name = Release;
@@ -911,6 +913,7 @@
911913
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
912914
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
913915
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
916+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
914917
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
915918
CLANG_WARN_STRICT_PROTOTYPES = YES;
916919
CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -932,13 +935,13 @@
932935
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
933936
GCC_WARN_UNUSED_FUNCTION = YES;
934937
GCC_WARN_UNUSED_VARIABLE = YES;
935-
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
938+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
936939
MACOSX_DEPLOYMENT_TARGET = 10.10;
937940
MTL_ENABLE_DEBUG_INFO = NO;
938941
ONLY_ACTIVE_ARCH = YES;
939942
SWIFT_OPTIMIZATION_LEVEL = "-O";
940943
SWIFT_VERSION = 5.0;
941-
TVOS_DEPLOYMENT_TARGET = 9.0;
944+
TVOS_DEPLOYMENT_TARGET = 12.0;
942945
WATCHOS_DEPLOYMENT_TARGET = 2.0;
943946
};
944947
name = "Performance Tests";

SwiftGraph.xcodeproj/xcshareddata/xcschemes/SwiftGraph.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1100"
3+
LastUpgradeVersion = "1240"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

0 commit comments

Comments
 (0)