DegreeDistribution
public struct DegreeDistribution
extension DegreeDistribution: Collection
A sparse collection of vertex counts, indexed by the integer degree.
-
The total number of directed edges in a graph.
Note: when a DegreeDistribution is computed for an undirected graph, each edge is counted twice.
Declaration
Swift
public let directedEdgeCount: Int
-
The total number of vertices in a graph.
Declaration
Swift
public let vertexCount: Int
-
An array with values corresponding to the number of vertices with a given degree.
Beware: This converts from a sparse to a dense representation, which could comsume significant memory.
Declaration
Swift
public var histogram: [Int] { get }
-
An array with values corresponding to the frequency with which a vertex of a given degree would be selected when vertices are selected at random from the graph.
Beware: This converts from a sparse to a dense representation, which could comsume significant memory.
Declaration
Swift
public var normalizedHistogram: [Double] { get }
-
Returns the most frequent degree, and the frequency with which it occurred.
Declaration
Swift
public var mode: (degree: Int, frequency: Int) { get }
-
The maximum degree for any vertex in the graph.
Declaration
Swift
public var maximumDegree: Int { get }
-
Returns the degrees, sorted by their frequency.
Declaration
Swift
public var sortedByFrequency: [(degree: Int, frequency: Int)] { get }
-
Accesses the number of vertices encountered with
degree
incident edges.Declaration
Swift
public subscript(degree: Int) -> Int { get }
-
The first valid index in
self
.Declaration
Swift
public var startIndex: Int { get }
-
Returns one past the last valid index into
self
.Declaration
Swift
public var endIndex: Int { get }
-
Returns the next valid index after
index
.Declaration
Swift
public func index(after index: Int) -> Int