Files
hello-algo/ja/codes/ruby/utils/vertex.rb
T
Yudong Jin 7257641e0e Retranslate the complete Japanese online edition from Chinese (#2008)
* Retranslate the complete Japanese online edition from Chinese

* Fit Japanese homepage labels and localize heading permalinks

* Point Japanese contribution instructions to the Japanese preview

* Replace locale conditionals with multilingual UI tables
2026-10-30 02:12:26 +08:00

25 lines
525 B
Ruby

=begin
File: vertex.rb
Created Time: 2024-04-25
Author: Xuan Khoa Tu Nguyen ([email protected])
=end
### 頂点クラス ###
class Vertex
attr_accessor :val
def initialize(val)
@val = val
end
end
### 値のリスト vals を入力し、頂点のリスト vets を返す ###
def vals_to_vets(vals)
Array.new(vals.length) { |i| Vertex.new(vals[i]) }
end
### 頂点のリスト vets を入力し、値のリスト vals を返す ###
def vets_to_vals(vets)
Array.new(vets.length) { |i| vets[i].val }
end