You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
599 B
30 lines
599 B
7 months ago
|
/**
|
||
|
* File: Vertex.dart
|
||
|
* Created Time: 2023-05-15
|
||
|
* Author: liuyuxin (gvenusleo@gmail.com)
|
||
|
*/
|
||
|
|
||
|
/* 頂點類別 */
|
||
|
class Vertex {
|
||
|
int val;
|
||
|
Vertex(this.val);
|
||
|
|
||
|
/* 輸入值串列 vals ,返回頂點串列 vets */
|
||
|
static List<Vertex> valsToVets(List<int> vals) {
|
||
|
List<Vertex> vets = [];
|
||
|
for (int i in vals) {
|
||
|
vets.add(Vertex(i));
|
||
|
}
|
||
|
return vets;
|
||
|
}
|
||
|
|
||
|
/* 輸入頂點串列 vets ,返回值串列 vals */
|
||
|
static List<int> vetsToVals(List<Vertex> vets) {
|
||
|
List<int> vals = [];
|
||
|
for (Vertex vet in vets) {
|
||
|
vals.add(vet.val);
|
||
|
}
|
||
|
return vals;
|
||
|
}
|
||
|
}
|