Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upMajor Refactor to GraphReporters #181
Conversation
|
@jayqi some initial feedback on the items you called out. Network vs Graph: I believe we should use the term Here's snippet from the Graph Theory wiki page:
and one from the Network Theory wiki page:
Given the extent of this refactor, this would be a good time to change the use of these terms in this package. Report Header Change: Change to * calculate_default_measures |
|
@jayqi, @jameslamb, and I had the luxury to meet IRL regarding this PR. With regard to the three items above, the consensus is:
|
Codecov Report
@@ Coverage Diff @@
## master #181 +/- ##
==========================================
+ Coverage 90.51% 91.52% +1.01%
==========================================
Files 10 11 +1
Lines 938 920 -18
==========================================
- Hits 849 842 -7
+ Misses 89 78 -11
Continue to review full report at Codecov.
|
|
@bburns632 @jameslamb --- This PR is ready for final review! |
|
Can you update the copyright year in footer.html please? |
| report_markdown_path = function(){ | ||
| system.file(file.path("package_report", "package_function_reporter.Rmd"), package = "pkgnet") | ||
| }, | ||
|
|
bburns632
Mar 1, 2019
Member
@jayqi Why are there R6 active bindings saved in package function reporter and not active bindings for S4 or R5? Seems odd to build active bindings for only one of many possible types.
@jayqi Why are there R6 active bindings saved in package function reporter and not active bindings for S4 or R5? Seems odd to build active bindings for only one of many possible types.
jayqi
Mar 2, 2019
Author
Collaborator
That's because they're not supported by Function Reporter. In any case, I'm going to move those bindings into private methods. I originally did it that way because I wanted to take advantage of active bindings' clean interface. But honestly I don't think users would or should need to use these methods, and they make the interface more complicated.
That's because they're not supported by Function Reporter. In any case, I'm going to move those bindings into private methods. I originally did it that way because I wanted to take advantage of active bindings' clean interface. But honestly I don't think users would or should need to use these methods, and they make the interface more complicated.
jayqi
Mar 2, 2019
•
Author
Collaborator
I opened #197 to call out that Function Reporter doesn't support S4 and RC yet.
And I've removed these active bindings. ✅
I opened #197 to call out that Function Reporter doesn't support S4 and RC yet.
And I've removed these active bindings.
|
I left a few comments. Overall looking good. One thing I couldn't figure out from the diff...can you give me a code snippet with the "main" user workflow with |
| @@ -19,7 +32,7 @@ None | |||
| * Revised unit test setup and teardown files to enable devtools::test() to work as well as CRAN server testing ([#167](https://github.com/UptakeOpenSource/pkgnet/pull/167)) | |||
|
|
|||
| ## BUG FIXES | |||
| * Corrected node statisitcs table merging error ([#165](https://github.com/UptakeOpenSource/pkgnet/issues/165), [#166](https://github.com/UptakeOpenSource/pkgnet/pull/166)) | |||
| * Corrected node statistics table merging error ([#165](https://github.com/UptakeOpenSource/pkgnet/issues/165), [#166](https://github.com/UptakeOpenSource/pkgnet/pull/166)) | |||
jameslamb
Mar 2, 2019
Member
could you make this a separate PR
could you make this a separate PR
jayqi
Mar 2, 2019
Author
Collaborator
Really? I don't want to screw with git to undo committing this. I also disagree that this kind of thing needs to be a separate PR. There is no discussion to be had, and setting the bar that high for fixing this kind of small typo makes it less likely that they get fixed. This file has no code and fixing this has no risk of breaking anything.
Really? I don't want to screw with git to undo committing this. I also disagree that this kind of thing needs to be a separate PR. There is no discussion to be had, and setting the bar that high for fixing this kind of small typo makes it less likely that they get fixed. This file has no code and fixing this has no risk of breaking anything.
jameslamb
Mar 3, 2019
Member
"screw with git to undo committing this" --> that is not what I'm recommending. If you made another PR it would get merged immediately (since it's such a small and non-controversial change) and when you rebased this PR to master the diff would disappear with no conflict.
It's fine for now because it seems this PR is close to being merged anyway, but in general I disagree with "setting the bar that high for fixing this kind of small typo makes it less likely that they get fixed". I dislike the pattern of long-lived large PRs picking up other small, unrelated changes because it means that anyone else doing development on the project will be waiting on those changes unnecessarily.
"screw with git to undo committing this" --> that is not what I'm recommending. If you made another PR it would get merged immediately (since it's such a small and non-controversial change) and when you rebased this PR to master the diff would disappear with no conflict.
It's fine for now because it seems this PR is close to being merged anyway, but in general I disagree with "setting the bar that high for fixing this kind of small typo makes it less likely that they get fixed". I dislike the pattern of long-lived large PRs picking up other small, unrelated changes because it means that anyone else doing development on the project will be waiting on those changes unnecessarily.
jayqi
Mar 3, 2019
Author
Collaborator
Okay, that's fine. I have had some bad experiences in the past where the rebase still gives me conflicts, but maybe that was just bad luck and I'm overcompensating.
Okay, that's fine. I have had some bad experiences in the past where the rebase still gives me conflicts, but maybe that was just bad luck and I'm overcompensating.
|
This is the bit I have in the vignette:
Basically right now, you can't add non-default measures into You'd need to take your reporter, whether from directly instantiation or via |
I think this is ready to go!
New AbstractGraph and DirectedGraph classes:
These objects will encapsulate all of the functionality related to the graph model of the package networks, including methods for calculating node and graph measures. They slot into the
pkg_graphin place of the igraph object.AbstractGraph base class
UndirectedGraph,BipartiteGraph(though I can't think of great reporters that use them. Maybe a package social graph with authors as edges?)Calculating measures
node_measuresandgraph_measures.graphBetweenness.node_measures()andgraph_measures()are used both to retrieve and to calculate specified measures.default_node_measuresanddefault_graph_measuresofDirectedGraph.Changes to individual measures
outSubgraphSizeandinSubgraphSizehave been replaced byrecursiveDepsandrecursiveRevDeps, which are comparatively decremented by 1 so as to not count the node itself. Resolves #191.inCloseness,graphInCloseness,authorityScore,graphAuthorityScoreoutBetweennessto justbetweenness. There is only one version of betweenness for directed graphs (pretty sure, and igraph doesn't a flag for that), and I don't think it makes sense to calculate undirected betweenness on a directed graph.Graph Reporter Refactor
graph_classthat must be assigned with aAbstractGraphclass constructor.pkg_graphnow stores theDirectedGraphobject. Accessing the igraph object would need:reporter$pkg_graph$igraphAbstractGraphReporter: new methodcalculate_default_measuresthat replaces the oldcalculate_network_measures.calculate_test_coverageinFunctionReporterhas been moved into this method.get_summary_viewand elsewhere.calculate_default_measuresis now explicitly called in each reporter's .Rmd file to account for the change.network_measuresactive binding now concatenates the pkg_graph's graph measures with any non-graph-related network measures. The only reporter currently with non-graph-related network measures is the FunctionReporter, which has coverage-related aggregate measures.Unit Test Overhaul
test-XReporter-class.Rtests the functionality of the class, andtest-XReporter-network.Rdoes expected value testing of the nodes and edges of the test packages against stored .csvs intests/testthat/testdatanames. This will include inherited members and is ultimately what is more relevant to what a user sees.setup-logger.Randteardown-logger.R. Resolves #170.Other:
set_package. Resolves #106.reset_cachemethod. Resolves #70set_packageandcalculate_default_measuresreturn self invisibly, enabling method chaining. Resolves #151.InheritanceReporter: Moved node and edge extraction into private methods to separate the functionality from the active bindings, whose job is to have a read-only view. I think this makes the code easier to read.FunctionReporter: Removed methodextract_networkwhich was unnecessarily wrappingextract_nodesandextract_edges.get_summary_viewwas consolidated intoAbstractGraphReportersince it seemed like it was the same code copy-pasted.package_dependency_reporter.Rmd. All blocks now instead haveerror = TRUEwhich should continue rendering on error but also print the error.