Implement InducedSubgraphView#43
Conversation
|
Remaining items to implement are:
Something to note is that I had to make the I think we should save the base GraphView class, which |
|
I'm looking at the |
|
Or do it on the first request to access the degrees |
Sounds good. I'll start working on adding that behavior. |
| // For mutable graphs, check exists | ||
| #pragma omp parallel for reduction(+ : sum) | ||
| for (omp_index v = 0; v < static_cast<omp_index>(z); ++v) { | ||
| if (exists[v]) { |
There was a problem hiding this comment.
This needs an updated for InducedSubgraphView?
| originalGraph.get().forInNeighborsOf(v, [&](node u, edgeweight ew) { | ||
| if (!hasNode(u) || u == v) | ||
| return; | ||
| ++inducedDegree[u]; |
There was a problem hiding this comment.
This keeps m from double-counting, but makes the public in-degree wrong for directed self-loops. Fixing this likely needs separate edge-count delta logic on removal too, since networkit/cpp/graph/InducedSubgraphView.cpp:119 currently subtract out-degree plus cached in-degree.
| build: | ||
| name: "${{ matrix.os }} (${{ matrix.compiler }})" | ||
| runs-on: ${{ matrix.runner }} | ||
| if: github.event_name != 'pull_request' || !github.event.pull_request.draft |
There was a problem hiding this comment.
What is this for? If necessary break it into a separate PR
There was a problem hiding this comment.
I did not want every commit on a draft PR to introduce a new CI workflow. Hmm, I can break it into a separate PR.
There was a problem hiding this comment.
Sometimes people want to use draft commits mainly for the CI. You can probably use this method to [skip ci]:
https://docs.github.com/en/actions/how-tos/manage-workflow-runs/skip-workflow-runs
| * Copy assignment | ||
| */ | ||
| InducedSubgraphView &operator=(const InducedSubgraphView &other) { | ||
| Graph::operator=(other); |
There was a problem hiding this comment.
This needs to handle originalGraph, nodeSubset, inducedDegree, and inducedInDegree etc
|
performance: Full edge traversal of a small view scans the entire base graph. n Also as an integration test, please run the abm14 graph and see if any runtime regressed due to the |
|
Details on the virtual vs templated. Only one problematic instance was found in the review. The nuance is that C++ templates are only “polymorphic” through the operations they call inside the instantiated base template. For example, Graph::forNodes is a template, so if code has: const Graph &g = view; it instantiates/runs Graph::forNodes, not InducedSubgraphView::forNodes. The branch partially mitigates that by changing many internal checks from exists[v] to virtual hasNode(v), so those base-template paths become correct but potentially slow. |
Implementation for issue #39