Skip to content

Instantly share code, notes, and snippets.

@zntfdr
Last active February 13, 2016 04:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zntfdr/e00940dadd3def522cc6 to your computer and use it in GitHub Desktop.
Save zntfdr/e00940dadd3def522cc6 to your computer and use it in GitHub Desktop.
init(toNode: Node, viaConnection: Connection?=nil, viaPath: Path?=nil) {
if let
previousPath = viaPath,
lastConnection = viaConnection {
self.cumulativeWeight = lastConnection.weight + previousPath.cumulativeWeight
} else {
self.cumulativeWeight = 0
}
self.lastNode = toNode
self.previousPath = viaPath
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment