Skip to content

Implement remaining network methods for networkLite#14

Draft
Copilot wants to merge 5 commits intomainfrom
copilot/implement-network-methods
Draft

Implement remaining network methods for networkLite#14
Copilot wants to merge 5 commits intomainfrom
copilot/implement-network-methods

Conversation

Copy link

Copilot AI commented Feb 9, 2026

networkLite lacked implementations for 8 network package methods. Two already worked (get.inducedSubgraph, network.density); six required implementation.

Implementation Strategy

The network package (version >= 1.19.0) provides S3 generics for these methods. This PR implements the .networkLite S3 methods that dispatch through the network package's native generics:

  • networkLite-specific implementations leveraging the simplified edgelist structure
  • Proper S3 method dispatch via network package generics

Methods Implemented

Edge queries:

  • get.edgeIDs.networkLite(x, v, alter, neighborhood, na.omit) - single dyad or incident edges
  • get.dyads.eids.networkLite(x, tails, heads, ...) - vectorized multi-dyad queries
  • get.edges.networkLite(x, v, alter, neighborhood, na.omit) - incident edge IDs

Topology queries:

  • is.adjacent.networkLite(x, vi, vj, na.omit) - edge existence test (default na.omit=FALSE matches network package)
  • get.neighborhood.networkLite(x, v, type, na.omit) - adjacent vertices
  • has.edges.networkLite(net, v) - any incident edges on vertices

Example Usage

nw <- networkLite(10, directed = TRUE)
add.edges(nw, c(1,2,3), c(2,3,4))

# Works with both networkLite and network objects
get.edgeIDs(nw, 1, 2)           # [1] 1
is.adjacent(nw, 1, 2)            # [1] TRUE
get.neighborhood(nw, 2)          # [1] 3 1

# Handles missing edges correctly
nw_na <- networkLite(5, directed = TRUE)
add.edges(nw_na, 1, 2, names.eval = list("na"), vals.eval = list(TRUE))
is.adjacent(nw_na, 1, 2, na.omit = FALSE)  # TRUE (edge exists)
is.adjacent(nw_na, 1, 2, na.omit = TRUE)   # FALSE (edge is missing)

All methods support directed/undirected/bipartite networks and properly handle the na edge attribute.

Compatibility

Requires network package >= 1.19.0 (currently on master branch) which provides the S3 generics for proper method dispatch.

Original prompt

This section details on the original issue you should resolve

<issue_title>Implement remaining network methods for networkLite if necessary.</issue_title>
<issue_description>They are:

  • get.edgeIDs()
  • get.edges()
  • get.dyads.eids()
  • get.inducedSubgraph()
  • get.neighborhood()
  • is.adjacent()
  • network.density()
  • has.edges()

Some of them may work out of the box, particularly if they do not depend on network's internal structure.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits February 9, 2026 05:23
Co-authored-by: krivit <15682462+krivit@users.noreply.github.com>
Co-authored-by: krivit <15682462+krivit@users.noreply.github.com>
….density

Co-authored-by: krivit <15682462+krivit@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement remaining network methods for networkLite Implement remaining network methods for networkLite Feb 9, 2026
Copilot AI requested a review from krivit February 9, 2026 05:34
@krivit
Copy link
Collaborator

krivit commented Feb 9, 2026

@copilot Refer to statnet/network@master for the current methods for network, which have been turned into generics.

Co-authored-by: krivit <15682462+krivit@users.noreply.github.com>
Copy link
Author

Copilot AI commented Feb 9, 2026

@copilot Refer to statnet/network@master for the current methods for network, which have been turned into generics.

Updated to use the generics from network package master branch. Removed the wrapper generic definitions and default methods, keeping only the .networkLite S3 methods. The implementation now properly dispatches via the network package's generics (commit 0373063).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement remaining network methods for networkLite if necessary.

2 participants