-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor graph copy and subgraph functions #373
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Punchline is there are two approaches to do a copy:
- mini-batch of all variables followed by all factors; or
- sequentially around each node in the graph (edge by edge).
Hi @GearsAD , is there a particular preference on approach for DB version? Johan is busy consolidating the various graph copy functions into one or two primary copy functions in DFG.
@@ -66,3 +66,14 @@ LightDFG(description::String, | |||
sessionData::Dict{Symbol, String}, | |||
solverParams::AbstractParams) = | |||
LightDFG(FactorGraph{Int,DFGVariable,DFGFactor}(), description, userId, robotId, sessionId, userData, robotData, sessionData, Symbol[], solverParams) | |||
|
|||
|
|||
LightDFG{T,V,F}(description::String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this not perhaps be an inner constructor, or does it not matter ( I'm not sure about the best practices on inner or outer constructors at the moment)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://docs.julialang.org/en/v1/manual/constructors/#man-inner-constructor-methods-1
It is good practice to provide as few inner constructor methods as possible: only those taking all arguments explicitly and enforcing essential error checking and transformation. Additional convenience constructor methods, supplying default values or auxiliary transformations, should be provided as outer constructors that call the inner constructors to do the heavy lifting. This separation is typically quite natural.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it thanks!
I think we can merge this, right? This is very cool, thanks @Affie ! |
LGTM, just one thing - is there any reason (other than the original function signatures) that we combine variables and factors as input to This just results in the lists being split up first thing into the function. If there isn't a reason beyond the initial design, I think we should split it up to make the calls more efficient. |
Btw, I meant that we can do that in a subsequent PR - I'll add that. This is good thanks. |
Oh I see you add it to the list already :) If you haven't started, let's save it for another PR |
Ok, will do separate PR. Just don't start using it in master yet. |
Close #300
Still to do:
buildSubgraph
_copyIntoGraph
in favor ofcopyGraph
/deepcopyGraph
/deepcopyGraph!
getSubgraph
in favor ofbuildSubgraph
getSubgraphAroundNode
in favor ofbuildSubgraph