Method: Tangle::BaseGraph#initialize
- Defined in:
- lib/tangle/base_graph.rb
#initialize(currify: false, mixins: [], **kwargs) ⇒ BaseGraph
Initialize a new graph, optionally preloading it with vertices and edges
Graph.new() => Graph Graph.new(mixins: [MixinModule, …], …) => Graph
mixins is an array of modules that can be mixed into the various classes that makes up a graph. Initialization of a Graph, Vertex or Edge looks for submodules in each mixin, with the same name and extends any created object. Defaults to [Tangle::Mixin::Connectedness].
Any subclass of Graph should also subclass Edge to manage its unique constraints.
52 53 54 55 56 57 |
# File 'lib/tangle/base_graph.rb', line 52 def initialize(currify: false, mixins: [], **kwargs) @currify = currify initialize_vertices initialize_edges initialize_mixins(mixins: mixins, **kwargs) end |