Simplify combined_networks: list-based class with lazy block-diagonal construction#44
Closed
Simplify combined_networks: list-based class with lazy block-diagonal construction#44
Conversation
Co-authored-by: krivit <15682462+krivit@users.noreply.github.com>
…etwork template handling, and NextMethod usage Co-authored-by: krivit <15682462+krivit@users.noreply.github.com>
…, improve .clear_edges, fix attrname typo Co-authored-by: krivit <15682462+krivit@users.noreply.github.com>
…dges robustness Co-authored-by: krivit <15682462+krivit@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] [statnet/ergm.multi-42] Simplify combined_networks structure
Simplify combined_networks: list-based class with lazy block-diagonal construction
Mar 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
combined_networkspreviously built an eager block-diagonalnetworkobject and stored constituent networks in a.subnetcacheattribute, wasting memory and complicating the data structure. The new design stores constituent networks directly and builds the block-diagonal on demand — analogous to hownetworkLitehas a different internal representation but the same S3 API.New internal structure
Changes
R/combined_networks_methods.R(new): Full S3 method suite —get/set/list/delete.network.attribute,get/set/list/delete.vertex.attribute,network.size,is.directed,network.edgecount,as.matrix, and a.clear_edges()helper compatible with bothnetworkandnetworkLiteR/combine.networks.R:combine_networks()populates$nw+$gal; no longer allocates a block-diagonal network at construction timeas.networkLite.combined_networks()builds the block-diagonal on demand (vertex attributes, edge list remapping, nested block-ID handling for both unipartite and bipartite cases)uncombine_network()for list-based objects simply returns$nw; for post-simulation networkLite-based objects, new.uncombine_network_from_blockdiag()uses block offsets instead ofget.inducedSubgraph()R/multinet.R:as_tibble.combined_networksdelegates edge/vertex units toas_tibble(as.networkLite(x))instead ofNextMethod(which would fail on the list structure)R/print.combined_networks.R:print/summary/print.summarysimplified;NextMethod()removed (incompatible with the list-based layout)Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/repos/EpiModel/networkLite/contents/R/usr/bin/curl curl -s REDACTED(http block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.