JuliaGraphs / JuliaGraphs/Graphs.jl

Question on neighbours functions returning a reference

Open
#316 9 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Julia
Stars
538
Forks
128
Avg merge
10h 25m
Merged PRs (30d)
2

Description

Question - the Graphs.inneighbors, Graphs.outneighbors and consequently Graphs.neighbors specify that they return a reference to the current graph's internal structures, rather than a copy. Having fallen afoul of this, I was wondering why this is the case - as far as I can tell this would be trivial to have return a copy instead, so I'm assuming it's intentional, but the only use case I can see would be modifying a graph in a way that would presumably be better handled by add_edge!() and rem_edge!()?

Thanks for your time!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read the documented contracts for Graphs.inneighbors, Graphs.outneighbors, and Graphs.neighbors, then inspect the add_edge!() and rem_edge!() mutation APIs. Determine whether returning references is intentional and identify the documentation or behavior change needed; done should include a clear API decision and corresponding documentation or test coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.