프로젝트
GitHub에서 보기
JuliaCollections/AbstractTrees.jl
소개
트리 구조를 다루기 위한 Julia 추상 인터페이스입니다.
기타 프로젝트측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalAbstractTrees
A package for dealing with generalized tree-like data structures.
Examples
julia> t = [[1,2], [3,4]]; # AbstractArray and AbstractDict are trees
julia> children(t)
2-element Vector{Vector{Int64}}:
[1, 2]
[3, 4]
julia> getdescendant(t, (2,1))
3
julia> collect(PreOrderDFS(t)) # iterate from root to leaves
7-element Vector{Any}:
[[1, 2], [3, 4]]
[1, 2]
1
2
[3, 4]
3
4
julia> collect(PostOrderDFS(t)) # iterate from leaves to root
7-element Vector{Any}:
1
2
[1, 2]
3
4
[3, 4]
[[1, 2], [3, 4]]
julia> collect(Leaves(t)) # iterate over leaves
4-element Vector{Int64}:
1
2
3
4
julia> struct FloatTree # make your own trees
x::Float64
children::Vector{FloatTree}
end;
julia> AbstractTrees.children(t::FloatTree) = t.children;
julia> AbstractTrees.nodevalue(t::FloatTree) = t.x;
julia> print_tree(FloatTree(NaN, [FloatTree(Inf, []), FloatTree(-Inf, [])]))
NaN
├─ Inf
└─ -Inf
Related Packages
- D3Trees.jl provides interactive rendering of large trees using the D3.js javascript package.
관련 프로젝트 살펴보기
불러오는 중…