-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Milestone
Description
DistributedFactorGraphs.jl/src/CloudGraphsDFG/services/CloudGraphsDFG.jl
Lines 465 to 492 in eaea68c
function getSubgraphAroundNode(dfg::CloudGraphsDFG, node::DFGNode, distance::Int64=1, includeOrphanFactors::Bool=false, addToDFG::AbstractDFG=_getDuplicatedEmptyDFG(dfg); solvable::Int=0)::AbstractDFG | |
distance < 1 && error("getSubgraphAroundNode() only works for distance > 0") | |
# Thank you Neo4j for 0..* awesomeness!! | |
neighborList = _getLabelsFromCyphonQuery(dfg.neo4jInstance, | |
""" | |
(n:$(dfg.userId):$(dfg.robotId):$(dfg.sessionId):$(node.label))-[FACTORGRAPH*0..$distance]-(node:$(dfg.userId):$(dfg.robotId):$(dfg.sessionId)) | |
WHERE (n:VARIABLE OR n:FACTOR OR node:VARIABLE OR node:FACTOR) | |
and not (node:SESSION) | |
and (node.solvable >= $solvable or node:$(dfg.userId):$(dfg.robotId):$(dfg.sessionId):$(node.label))""" # Always return the root node | |
) | |
# Copy the section of graph we want | |
_copyIntoGraph!(dfg, addToDFG, neighborList, includeOrphanFactors) | |
return addToDFG | |
end | |
function getSubgraph(dfg::CloudGraphsDFG, | |
variableFactorLabels::Vector{Symbol}, | |
includeOrphanFactors::Bool=false, | |
addToDFG::G=_getDuplicatedEmptyDFG(dfg) )::G where {G <: AbstractDFG} | |
# Making a copy session if not specified | |
_copyIntoGraph!(dfg, addToDFG, variableFactorLabels, includeOrphanFactors) | |
return addToDFG | |
end |
see