Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

remove_nodes doesn't update graph_indicator on batched graphs

Aperta
#716 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

@parth-patel010 ci sta già lavorando.

Dal 27/10/2026.

  • #717 di @parth-patel010 — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
julia
Ambito
backend

Direzione di ricerca

The issue identifies remove_nodes(g::GNNGraph{<:COO_T}, nodes_to_remove) and explains that graph_indicator retains entries for removed nodes. Read that method and compare its handling of graph_indicator with ndata; the issue suggests indexing by the kept nodes. Done means the indicator matches the remaining nodes and the batched unbatch and getgraph calls no longer raise BoundsError. An open linked pull request (#717) is already addressing this issue.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

remove_nodes doesn't update graph_indicator, so on a batched graph the result keeps the old indicator (one entry per original node). The graph looks fine when printed, but unbatch / getgraph on it then throw a BoundsError.

MWE

using GNNGraphs, MLUtils

g = MLUtils.batch([rand_graph(3, 4, ndata = rand(Float32, 2, 3)),
                   rand_graph(4, 6, ndata = rand(Float32, 2, 4))])

g2 = remove_nodes(g, [1])

g2.num_nodes        # 6
g2.graph_indicator  # [1, 1, 1, 2, 2, 2, 2]  -> still 7 entries, should be [1, 1, 2, 2, 2, 2]

MLUtils.unbatch(g2) # BoundsError: attempt to access 2×6 Matrix{Float32} at index [1:2, 4:7]
getgraph(g2, 2)     # BoundsError: attempt to access 2×6 Matrix{Float32} at index [1:2, [4, 5, 6, 7]]

Node features, edges and the node count are all updated correctly, only graph_indicator is passed through unchanged in remove_nodes(g::GNNGraph{<:COO_T}, nodes_to_remove). Since remove_nodes(g, p) calls the same method, node dropping on a batch of graphs hits this too.

I think the fix is just to index the indicator with the kept nodes (g.graph_indicator[nodes_to_keep]) like is already done for ndata.

GNNGraphs master (17d1906, 1.6.0-DEV), Julia 1.12.1

Lingua principale
Julia
Stelle
310
Fork
74
Merge medio
3g 23h
PR unite (30g)
2

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di JuliaGraphs/GraphNeuralNetworks.jl

Tutte le issue di JuliaGraphs/GraphNeuralNetworks.jl

Issue simili

Altre issue su Julia

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.