Repository navigation
feat(base_graph): add topology queries, hypergraph incidence/adjacency matrix exports, and serialization - #74
Open
ashishsoni-ai wants to merge 1 commit into
Conversation
…y matrix exports, and serialization - Implemented node and edge query methods: has_node, get_node, get_nodes, has_edge, get_edge, get_edges. - Added graph topology operations: neighbors, degree, incident_edges, remove_node (with automatic incident edge pruning), and remove_edge. - Added hypergraph and GNN export utilities: * to_incidence_matrix: generates (N, E) node-edge incidence matrix for Hyper-SAGNN and HGNN models. * to_adjacency_matrix: computes (N, N) binary/weighted adjacency matrix with hyperedge clique expansion. * to_edge_index: exports PyG-style (2, E) edge index for GNN pipelines. - Added dictionary serialization: to_dict and from_dict. - Added __len__ and __repr__ for clean Pythonic representation. - Exported BaseGraph at top-level devograph module. - Added comprehensive unit tests in test/test_base_graph.py covering all added functionality.
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.
Description
This PR enhances \devograph.base_graph.BaseGraph, the core graph data structure in DevoGraph, by adding essential topology query methods, hypergraph matrix representations for GNN models, removal operations, and serialization support.
Previously, \BaseGraph\ provided only basic \�dd_node, \�dd_edge,
um_nodes, and
um_edges. Downstream pipelines in DevoGraph (such as \Dynamic-HGNN\ and \HyperDevoGraph) require querying node neighborhoods, computing node degrees, generating hypergraph incidence matrices, and exporting PyG-compatible edge indices.
Changes Made
Node and Edge Queries:
Graph Topology Operations:
eighbors(node_id): retrieve all neighboring nodes connected via pairwise edges or multi-node hyperedges.
emove_node(node_id): remove a node and prune all incident edges.
emove_edge(index): remove an edge by index.
Hypergraph & GNN Matrix Exports:
Serialization & Magic Methods:
Top-Level Package Export:
Comprehensive Unit Testing: