Skip to content
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

Merged
merged 7 commits into from
Apr 13, 2020
Merged

Conversation

Affie
Copy link
Member

@Affie Affie commented Apr 2, 2020

Close #300
Still to do:

  • add tests for buildSubgraph
  • deprecate _copyIntoGraph in favor of copyGraph/deepcopyGraph/deepcopyGraph!
  • deprecate getSubgraph in favor of buildSubgraph
  • deprecate getSubgraphAroundNode in favor of buildSubgraph

@Affie Affie added this to the v0.7.3 milestone Apr 2, 2020
@Affie Affie requested review from dehann and GearsAD April 2, 2020 13:09
Copy link
Member

@dehann dehann left a 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.

@Affie Affie marked this pull request as ready for review April 9, 2020 15:57
@@ -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,
Copy link
Member

@dehann dehann Apr 10, 2020

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)?

Copy link
Member Author

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it thanks!

@dehann
Copy link
Member

dehann commented Apr 10, 2020

I think we can merge this, right? This is very cool, thanks @Affie !

@GearsAD
Copy link
Collaborator

GearsAD commented Apr 11, 2020

LGTM, just one thing - is there any reason (other than the original function signatures) that we combine variables and factors as input to copyGraph!, e.g. variableFactorLabels::Vector{Symbol};?

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.

@GearsAD
Copy link
Collaborator

GearsAD commented Apr 12, 2020

Btw, I meant that we can do that in a subsequent PR - I'll add that. This is good thanks.

@GearsAD
Copy link
Collaborator

GearsAD commented Apr 12, 2020

Oh I see you add it to the list already :) If you haven't started, let's save it for another PR

@Affie Affie merged commit d708217 into master Apr 13, 2020
@Affie
Copy link
Member Author

Affie commented Apr 13, 2020

Ok, will do separate PR. Just don't start using it in master yet.

@Affie Affie deleted the maint/20Q1/refactCopy300 branch August 31, 2020 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor graph copy functions
3 participants