Closed schillic closed 5 years ago
Merging #30 into master will decrease coverage by
1.84%
. The diff coverage is50%
.
@@ Coverage Diff @@
## master #30 +/- ##
==========================================
- Coverage 81.36% 79.51% -1.85%
==========================================
Files 6 6
Lines 161 166 +5
==========================================
+ Hits 131 132 +1
- Misses 30 34 +4
Impacted Files | Coverage Δ | |
---|---|---|
src/light.jl | 74.66% <50%> (-3.91%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update ce9996e...12070c7. Read the comment docs.
Sorry, I do not see how to incorporate the type in the proper way :disappointed:
How about:
$ git diff
diff --git a/src/light.jl b/src/light.jl
index 42859d3..b729e37 100644
--- a/src/light.jl
+++ b/src/light.jl
@@ -171,7 +171,7 @@ function in_transitions(A::LightAutomaton, s)
LightTransitionIterator(A, edges)
end
function out_transitions(A::LightAutomaton, s)
- edges = MappedArrays.mappedarray(dst -> edge_object(A, s, dst),
+ edges = MappedArrays.mappedarray(Int, dst -> edge_object(A, s, dst),
LightGraphs.outneighbors(A.G, s))
LightTransitionIterator(A, edges)
end
Then:
julia> out_transitions(H, 2)
LightTransitionIterator{SimpleDiGraph{Int64},LightGraphs.SimpleGraphs.SimpleEdge{Int64},MappedArrays.MultiMappedArray{Int64,1,Tuple{Arra
y{Int64,1}},Type{Int64},getfield(Main, Symbol("##5#6")){LightAutomaton{SimpleDiGraph{Int64},LightGraphs.SimpleGraphs.SimpleEdge{Int64}},
Int64}}}(LightAutomaton{SimpleDiGraph{Int64},LightGraphs.SimpleGraphs.SimpleEdge{Int64}}({2, 2} directed simple Int64 graph, Dict(Edge 1
=> 1=>Dict(1=>1),Edge 1 => 2=>Dict(2=>2)), 2, 2), Int64[])
julia> isempty(out_transitions(H, s))
true
Sorry, I do not see how to incorporate the type in the proper way
The types of source and dest are always Int
's (see this line).
I also tried that, but the result differs from the previous one in master
(ReadonlyMappedArray
vs. MultiMappedArray
). See this example with a println(out_transitions(H, 1))
.
in master
:
HybridSystems.LightTransitionIterator{
LightGraphs.SimpleGraphs.SimpleDiGraph{Int64},
LightGraphs.SimpleGraphs.SimpleEdge{Int64},
MappedArrays.ReadonlyMappedArray{
LightGraphs.SimpleGraphs.SimpleEdge{Int64},1,Array{Int64,1},
getfield(HybridSystems, Symbol("##21#22")){LightAutomaton{
LightGraphs.SimpleGraphs.SimpleDiGraph{Int64},
LightGraphs.SimpleGraphs.SimpleEdge{Int64}},Int64}
}
}(LightAutomaton{LightGraphs.SimpleGraphs.SimpleDiGraph{Int64},
LightGraphs.SimpleGraphs.SimpleEdge{Int64}}
({2, 2} directed simple Int64 graph,
Dict(Edge 1 => 2=>Dict(2=>2),Edge 1 => 1=>Dict(1=>1)), 2, 2),
LightGraphs.SimpleGraphs.SimpleEdge{Int64}[Edge 1 => 1, Edge 1 => 2])
using Int
:
HybridSystems.LightTransitionIterator{
LightGraphs.SimpleGraphs.SimpleDiGraph{Int64},
LightGraphs.SimpleGraphs.SimpleEdge{Int64},
MappedArrays.MultiMappedArray{
Int64,1,Tuple{Array{Int64,1}},Type{Int64},
getfield(HybridSystems, Symbol("##25#26")){
LightAutomaton{LightGraphs.SimpleGraphs.SimpleDiGraph{Int64},
LightGraphs.SimpleGraphs.SimpleEdge{Int64}},Int64}
}
}(LightAutomaton{LightGraphs.SimpleGraphs.SimpleDiGraph{Int64},
LightGraphs.SimpleGraphs.SimpleEdge{Int64}}
({2, 2} directed simple Int64 graph,
Dict(Edge 1 => 2=>Dict(2=>2),Edge 1 => 1=>Dict(1=>1)), 2, 2), [1, 2])
This is one attempt to close #29.
This workaround is not very elegant due to the restriction that I want to make the code type stable. Note that it relies onLightGraphs
to return an empty list for non-existing nodes. I understand if you do not accept this workaround.