@@ -37,12 +37,18 @@ struct DiffGraph <: Graphs.AbstractGraph{Int}
37
37
primal_to_diff:: Vector{Union{Int, Nothing}}
38
38
diff_to_primal:: Union{Nothing, Vector{Union{Int, Nothing}}}
39
39
end
40
+
40
41
DiffGraph (primal_to_diff:: Vector{Union{Int, Nothing}} ) = DiffGraph (primal_to_diff, nothing )
41
42
function DiffGraph (n:: Integer , with_badj:: Bool = false )
42
43
DiffGraph (Union{Int, Nothing}[nothing for _ in 1 : n],
43
44
with_badj ? Union{Int, Nothing}[nothing for _ in 1 : n] : nothing )
44
45
end
45
46
47
+ function Base. copy (dg:: DiffGraph )
48
+ DiffGraph (copy (dg. primal_to_diff),
49
+ dg. diff_to_primal === nothing ? nothing : copy (dg. diff_to_primal))
50
+ end
51
+
46
52
@noinline function require_complete (dg:: DiffGraph )
47
53
dg. diff_to_primal === nothing &&
48
54
error (" Not complete. Run `complete` first." )
@@ -145,6 +151,13 @@ Base.@kwdef mutable struct SystemStructure
145
151
solvable_graph:: Union{BipartiteGraph{Int, Nothing}, Nothing}
146
152
only_discrete:: Bool
147
153
end
154
+
155
+ function Base. copy (structure:: SystemStructure )
156
+ SystemStructure (copy (structure. var_to_diff), copy (structure. eq_to_diff),
157
+ copy (structure. graph), copy (structure. solvable_graph),
158
+ structure. only_discrete)
159
+ end
160
+
148
161
is_only_discrete (s:: SystemStructure ) = s. only_discrete
149
162
isdervar (s:: SystemStructure , i) = invview (s. var_to_diff)[i] != = nothing
150
163
function isalgvar (s:: SystemStructure , i)
0 commit comments