class ReRooting(T, GraphType)

Overview

Example of T:

struct DP
  getter val : Int64, cnt : Int32

  def initialize
    @val, @cnt = 0i64, 0
  end

  def initialize(@val, @cnt)
  end

  def +(other : self) : self
    DP.new(val + other.val, cnt + other.cnt)
  end

  def add_root(v : Int32) : self
    DP.new(val + cnt, cnt + 1)
  end
end

Defined in:

graph/re_rooting.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(size : Int, edges : Enumerable) #

[View source]
def self.new(size : Int) #

[View source]
def self.new(graph : GraphType) #

[View source]

Instance Method Detail

def <<(*args, **options) #

[View source]
def <<(*args, **options, &) #

[View source]
def add_edges(*args, **options) #

[View source]
def add_edges(*args, **options, &) #

[View source]
def graph : GraphType #

[View source]
def size(*args, **options) #

[View source]
def size(*args, **options, &) #

[View source]
def solve : Array(T) #

[View source]