@@ -209,14 +209,12 @@ Delete the referened DFGFactor from the DFG.
209
209
"""
210
210
deleteFactor! (dfg:: GraphsDFG , factor:: DFGFactor ):: DFGFactor = deleteFactor! (dfg, factor. label)
211
211
212
- # # Returns a flat vector of the vertices, keyed by ID.
213
- # # Assuming only variables here for now - think maybe not, should be variables+factors?
214
212
"""
215
213
$(SIGNATURES)
216
214
List the DFGVariables in the DFG.
217
215
Optionally specify a label regular expression to retrieves a subset of the variables.
218
216
"""
219
- function ls (dfg:: GraphsDFG , regexFilter:: Union{Nothing, Regex} = nothing ; tags:: Vector{Symbol} = Symbol[]):: Vector{DFGVariable}
217
+ function getVariables (dfg:: GraphsDFG , regexFilter:: Union{Nothing, Regex} = nothing ; tags:: Vector{Symbol} = Symbol[]):: Vector{DFGVariable}
220
218
variables = map (v -> v. dfgNode, filter (n -> n. dfgNode isa DFGVariable, vertices (dfg. g)))
221
219
if regexFilter != nothing
222
220
variables = filter (v -> occursin (regexFilter, String (v. label)), variables)
@@ -228,14 +226,6 @@ function ls(dfg::GraphsDFG, regexFilter::Union{Nothing, Regex}=nothing; tags::Ve
228
226
return variables
229
227
end
230
228
231
- # Alias
232
- """
233
- $(SIGNATURES)
234
- List the DFGVariables in the DFG.
235
- Optionally specify a label regular expression to retrieves a subset of the variables.
236
- """
237
- getVariables (dfg:: GraphsDFG , regexFilter:: Union{Nothing, Regex} = nothing ; tags:: Vector{Symbol} = Symbol[]):: Vector{DFGVariable} = ls (dfg, regexFilter, tags= tags)
238
-
239
229
"""
240
230
$(SIGNATURES)
241
231
Get a list of IDs of the DFGVariables in the DFG.
@@ -251,42 +241,54 @@ Related
251
241
ls
252
242
"""
253
243
function getVariableIds (dfg:: GraphsDFG , regexFilter:: Union{Nothing, Regex} = nothing ; tags:: Vector{Symbol} = Symbol[]):: Vector{Symbol}
254
- vars = ls (dfg, regexFilter, tags= tags)
244
+ vars = getVariables (dfg, regexFilter, tags= tags)
255
245
# mask = map(v -> length(intersect(v.tags, tags)) > 0, vars )
256
246
map (v -> v. label, vars)
257
247
end
258
248
249
+ # Alias
250
+ """
251
+ $(SIGNATURES)
252
+ List the DFGVariables in the DFG.
253
+ Optionally specify a label regular expression to retrieves a subset of the variables.
254
+ """
255
+ ls (dfg:: GraphsDFG , regexFilter:: Union{Nothing, Regex} = nothing ; tags:: Vector{Symbol} = Symbol[]):: Vector{Symbol} = getVariableIds (dfg, regexFilter, tags= tags)
259
256
260
257
"""
261
258
$(SIGNATURES)
262
259
List the DFGFactors in the DFG.
263
260
Optionally specify a label regular expression to retrieves a subset of the factors.
264
261
"""
265
- function lsf (dfg:: GraphsDFG , regexFilter:: Union{Nothing, Regex} = nothing ):: Vector{DFGFactor}
266
- factors = map (v -> v. dfgNode, filter (n -> n. dfgNode isa DFGFactor, vertices (dfg. g)))
267
- if regexFilter != nothing
268
- factors = filter (f -> occursin (regexFilter, String (f. label)), factors)
269
- end
270
- return factors
271
- end
272
- function lsf (dfg:: GraphsDFG , label:: Symbol ):: Vector{Symbol}
273
- return getNeighbors (dfg, label)
262
+ function getFactors (dfg:: GraphsDFG , regexFilter:: Union{Nothing, Regex} = nothing ):: Vector{DFGFactor}
263
+ factors = map (v -> v. dfgNode, filter (n -> n. dfgNode isa DFGFactor, vertices (dfg. g)))
264
+ if regexFilter != nothing
265
+ factors = filter (f -> occursin (regexFilter, String (f. label)), factors)
266
+ end
267
+ return factors
274
268
end
275
269
276
- # Alias
277
270
"""
278
271
$(SIGNATURES)
279
- List the DFGFactors in the DFG.
272
+ Get a list of the IDs of the DFGFactors in the DFG.
280
273
Optionally specify a label regular expression to retrieves a subset of the factors.
281
274
"""
282
- getFactors (dfg:: GraphsDFG , regexFilter:: Union{Nothing, Regex} = nothing ):: Vector{DFGFactor } = lsf ( dfg, regexFilter)
275
+ getFactorIds (dfg:: GraphsDFG , regexFilter:: Union{Nothing, Regex} = nothing ):: Vector{Symbol } = map (f -> f . label, getFactors ( dfg, regexFilter) )
283
276
284
277
"""
285
278
$(SIGNATURES)
286
- Get a list of the IDs of the DFGFactors in the DFG.
279
+ List the DFGFactors in the DFG.
287
280
Optionally specify a label regular expression to retrieves a subset of the factors.
288
281
"""
289
- getFactorIds (dfg:: GraphsDFG , regexFilter:: Union{Nothing, Regex} = nothing ):: Vector{Symbol} = map (f -> f. label, lsf (dfg, regexFilter))
282
+ # Alias
283
+ lsf (dfg:: GraphsDFG , regexFilter:: Union{Nothing, Regex} = nothing ):: Vector{Symbol} = getFactorIds (dfg, regexFilter)
284
+
285
+ """
286
+ $(SIGNATURES)
287
+ Alias for getNeighbors - returns neighbors around a given node label.
288
+ """
289
+ function lsf (dfg:: GraphsDFG , label:: Symbol ):: Vector{Symbol}
290
+ return getNeighbors (dfg, label)
291
+ end
290
292
291
293
"""
292
294
$(SIGNATURES)
0 commit comments