195
195
$(SIGNATURES)
196
196
Delete a referenced DFGVariable from the DFG.
197
197
"""
198
- deleteVariable! (dfg:: GraphsDFG , variable:: DFGVariable ):: DFGVariable = deleteVariable (dfg, variable. label)
198
+ deleteVariable! (dfg:: GraphsDFG , variable:: DFGVariable ):: DFGVariable = deleteVariable! (dfg, variable. label)
199
199
200
200
"""
201
201
$(SIGNATURES)
@@ -224,7 +224,7 @@ List the DFGVariables in the DFG.
224
224
Optionally specify a label regular expression to retrieves a subset of the variables.
225
225
"""
226
226
function getVariables (dfg:: GraphsDFG , regexFilter:: Union{Nothing, Regex} = nothing ; tags:: Vector{Symbol} = Symbol[]):: Vector{DFGVariable}
227
- variables = map (v -> v. dfgNode, filter (n -> n. dfgNode isa DFGVariable, vertices (dfg. g)))
227
+ variables = map (v -> v. dfgNode, filter (n -> n. dfgNode isa DFGVariable, Graphs . vertices (dfg. g)))
228
228
if regexFilter != nothing
229
229
variables = filter (v -> occursin (regexFilter, String (v. label)), variables)
230
230
end
@@ -269,7 +269,7 @@ List the DFGFactors in the DFG.
269
269
Optionally specify a label regular expression to retrieves a subset of the factors.
270
270
"""
271
271
function getFactors (dfg:: GraphsDFG , regexFilter:: Union{Nothing, Regex} = nothing ):: Vector{DFGFactor}
272
- factors = map (v -> v. dfgNode, filter (n -> n. dfgNode isa DFGFactor, vertices (dfg. g)))
272
+ factors = map (v -> v. dfgNode, filter (n -> n. dfgNode isa DFGFactor, Graphs . vertices (dfg. g)))
273
273
if regexFilter != nothing
274
274
factors = filter (f -> occursin (regexFilter, String (f. label)), factors)
275
275
end
304
304
Checks if the graph is fully connected, returns true if so.
305
305
"""
306
306
function isFullyConnected (dfg:: GraphsDFG ):: Bool
307
- return length (connected_components (dfg. g)) == 1
307
+ return length (Graphs . connected_components (dfg. g)) == 1
308
308
end
309
309
310
310
# Alias
@@ -326,8 +326,8 @@ function getNeighbors(dfg::GraphsDFG, node::T; ready::Union{Nothing, Int}=nothin
326
326
vert = dfg. g. vertices[dfg. labelDict[node. label]]
327
327
neighbors = in_neighbors (vert, dfg. g) # Don't use out_neighbors! It enforces directiveness even if we don't want it
328
328
# Additional filtering
329
- neighbors = ready != nothing ? filter (v -> v. ready == ready, neighbors) : neighbors
330
- neighbors = backendset != nothing ? filter (v -> v. backendset == backendset, neighbors) : neighbors
329
+ neighbors = ready != nothing ? filter (v -> v. dfgNode . ready == ready, neighbors) : neighbors
330
+ neighbors = backendset != nothing ? filter (v -> v. dfgNode . backendset == backendset, neighbors) : neighbors
331
331
# Variable sorting (order is important)
332
332
if node isa DFGFactor
333
333
order = intersect (node. _variableOrderSymbols, map (v-> v. dfgNode. label, neighbors))
@@ -347,8 +347,8 @@ function getNeighbors(dfg::GraphsDFG, label::Symbol; ready::Union{Nothing, Int}=
347
347
vert = dfg. g. vertices[dfg. labelDict[label]]
348
348
neighbors = in_neighbors (vert, dfg. g) # Don't use out_neighbors! It enforces directiveness even if we don't want it
349
349
# Additional filtering
350
- neighbors = ready != nothing ? filter (v -> v. ready == ready, neighbors) : neighbors
351
- neighbors = backendset != nothing ? filter (v -> v. backendset == backendset, neighbors) : neighbors
350
+ neighbors = ready != nothing ? filter (v -> v. dfgNode . ready == ready, neighbors) : neighbors
351
+ neighbors = backendset != nothing ? filter (v -> v. dfgNode . backendset == backendset, neighbors) : neighbors
352
352
# Variable sorting when using a factor (function order is important)
353
353
if vert. dfgNode isa DFGFactor
354
354
vert. dfgNode. _variableOrderSymbols
@@ -451,7 +451,7 @@ Get a deep subgraph copy from the DFG given a list of variables and factors.
451
451
Optionally provide an existing subgraph addToDFG, the extracted nodes will be copied into this graph. By default a new subgraph will be created.
452
452
Note: By default orphaned factors (where the subgraph does not contain all the related variables) are not returned. Set includeOrphanFactors to return the orphans irrespective of whether the subgraph contains all the variables.
453
453
"""
454
- function getSubgraph (dfg:: GraphsDFG , variableFactorLabels:: Vector{Symbol} , includeOrphanFactors:: Bool = false , addToDFG:: GraphsDFG = GraphsDFG ()):: GraphsDFG
454
+ function getSubgraph (dfg:: GraphsDFG , variableFactorLabels:: Vector{Symbol} , includeOrphanFactors:: Bool = false , addToDFG:: GraphsDFG = GraphsDFG {AbstractParams} ()):: GraphsDFG
455
455
for label in variableFactorLabels
456
456
if ! haskey (dfg. labelDict, label)
457
457
error (" Variable/factor with label '$(label) ' does not exist in the factor graph" )
0 commit comments