Module: Tangle::Mixin::Connectedness::Vertex

Included in:
Ancestry::Vertex
Defined in:
lib/tangle/mixin/connectedness.rb

Overview

Mixin for adding connectedness to a vertex

Instance Method Summary collapse

Instance Method Details

#connected?(other, test_method: :adjacent?) ⇒ Boolean

Two vertices are connected if there is a path between them, and a vertex is connected to itself.

Returns:

  • (Boolean)

Raises:



56
57
58
59
60
61
# File 'lib/tangle/mixin/connectedness.rb', line 56

def connected?(other, test_method: :adjacent?)
  raise GraphError unless @graph == other.graph
  return true if self == other

  connected_excluding?(other, test_method, Set[self])
end