Skip to content

Commit 44072f6

Browse files
committed
cloud solve
1 parent 55e3459 commit 44072f6

File tree

6 files changed

+43
-15
lines changed

6 files changed

+43
-15
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
deps/deps.jl
55
docs/build
66
Manifest.toml
7+
dev

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ Requires = "ae029012-a4dd-5104-9daa-d747884805df"
2020
Distributions = "≥ 0.18"
2121
DocStringExtensions = "≥ 0.7"
2222
Graphs = "≥ 0.10.3"
23+
MetaGraphs = "≥ 0.6.4"
2324
Reexport = "≥ 0.2"
2425
Requires = "≥ 0.5"
2526
julia = "0.7, 1"
26-
MetaGraphs = "≥ 0.6.4"
2727

2828
[extras]
2929
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

src/CloudGraphsDFG/services/CloudGraphsDFG.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,19 @@ function getSubgraphAroundNode(dfg::CloudGraphsDFG, node::T, distance::Int64=1,
720720
return addToDFG
721721
end
722722

723+
function getSubgraphAroundNode(dfg::CloudGraphsDFG{<:AbstractParams}, node::DFGNode, distance::Int64=1, includeOrphanFactors::Bool=false, addToDFG::AbstractDFG=LightGraphsDFG{AbstractParams}())::AbstractDFG
724+
distance < 1 && error("getSubgraphAroundNode() only works for distance > 0")
725+
726+
727+
# Thank you Neo4j for 0..* awesomeness!!
728+
neighborList = _getLabelsFromCyphonQuery(dfg.neo4jInstance, "(n:$(dfg.userId):$(dfg.robotId):$(dfg.sessionId):$(node.label))-[FACTORGRAPH*0..$distance]-(node:$(dfg.userId):$(dfg.robotId):$(dfg.sessionId))")
729+
730+
# Copy the section of graph we want
731+
_copyIntoGraph!(dfg, addToDFG, neighborList, includeOrphanFactors)
732+
return addToDFG
733+
end
734+
735+
723736
"""
724737
$(SIGNATURES)
725738
Get a deep subgraph copy from the DFG given a list of variables and factors.

src/DistributedFactorGraphs.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,18 @@ function __init__()
7575
end
7676
end
7777

78+
#FIXME JT not sure how to handle this
79+
#=
7880
@require Neo4j="d2adbeaf-5838-5367-8a2f-e46d570981db" begin
7981
# Include the Cloudgraphs API
8082
include("CloudGraphsDFG/CloudGraphsDFG.jl")
8183
end
84+
=#
8285
end
8386

87+
#FIXME JT not sure how to handle this, is it not lightweitgh enought to always include?
88+
include("CloudGraphsDFG/CloudGraphsDFG.jl")
89+
8490
# not sure where to put
8591
include("Common.jl")
8692
include("NeedsAHome.jl")

src/LightGraphsDFG/entities/LightGraphsDFG.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,14 @@ Base.getproperty(x::LightGraphsDFG,f::Symbol) = begin
5353
getfield(x,f)
5454
end
5555
end
56+
57+
"""
58+
$(TYPEDEF)
59+
Basic Structure for just the LightGraphs object and keys
60+
"""
61+
struct LightGraphsSkeleton
62+
G::LightGraphs.SimpleGraph
63+
labels::Dict{Symbol, Int}
64+
end
65+
66+
LightGraphsSkeleton(dfg::LightGraphsDFG) = LightGraphsSkeleton(dfg.g.graph, dfg.g.metaindex[:label])

src/LightGraphsDFG/services/LightGraphsDFG.jl

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -531,13 +531,12 @@ end
531531
Produces a dot-format of the graph for visualization.
532532
"""
533533
function toDot(dfg::LightGraphsDFG)::String
534-
# m = PipeBuffer()
535-
# write(m,Graphs.to_dot(dfg.g))
536-
# data = take!(m)
537-
# close(m)
538-
# return String(data)
539-
@error "toDot(dfg::LightGraphsDFG) is not sopported yet"
540-
return nothing
534+
@error "toDot(dfg::LightGraphsDFG) is not sopported yet, see https://github.com/JuliaGraphs/MetaGraphs.jl/issues/86"
535+
m = PipeBuffer()
536+
MetaGraphs.savedot(m, dfg.g)
537+
data = take!(m)
538+
close(m)
539+
return String(data)
541540
end
542541

543542
"""
@@ -551,11 +550,9 @@ Note
551550
- Based on graphviz.org
552551
"""
553552
function toDotFile(dfg::LightGraphsDFG, fileName::String="/tmp/dfg.dot")::Nothing
554-
# open(fileName, "w") do fid
555-
# write(fid,Graphs.to_dot(dfg.g))
556-
# end
557-
# return nothing
558-
#TODO
559-
@error "toDotFile(dfg::LightGraphsDFG,filename) is not sopported yet"
560-
return nothing
553+
@error "toDotFile(dfg::LightGraphsDFG,filename) is not sopported yet, see https://github.com/JuliaGraphs/MetaGraphs.jl/issues/86"
554+
open(fileName, "w") do fid
555+
MetaGraphs.savedot(fid, dfg.g)
556+
end
557+
return nothing
561558
end

0 commit comments

Comments
 (0)