Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create induced subgraph from edge list #37

Merged
merged 6 commits into from
Apr 28, 2023
Merged

Create induced subgraph from edge list #37

merged 6 commits into from
Apr 28, 2023

Conversation

pgrepds
Copy link
Contributor

@pgrepds pgrepds commented Mar 26, 2023

In order to fix #32, I have added an implementation of the induced_subgraph function that creates an edge induced subgraph from a list of edges.

@gdalle
Copy link
Member

gdalle commented Mar 27, 2023

Thanks for the contribution!

@codecov
Copy link

codecov bot commented Mar 27, 2023

Codecov Report

Merging #37 (20a12a0) into master (c508a11) will increase coverage by 0.25%.
The diff coverage is 100.00%.

❗ Current head 20a12a0 differs from pull request most recent head 0d2e8e2. Consider uploading reports for the commit 0d2e8e2 to get more accurate results

@@            Coverage Diff             @@
##           master      #37      +/-   ##
==========================================
+ Coverage   94.80%   95.06%   +0.25%     
==========================================
  Files           9        9              
  Lines         443      466      +23     
==========================================
+ Hits          420      443      +23     
  Misses         23       23              
Impacted Files Coverage Δ
src/overrides.jl 100.00% <100.00%> (ø)

gdalle
gdalle previously requested changes Mar 27, 2023
src/overrides.jl Outdated Show resolved Hide resolved
src/overrides.jl Outdated Show resolved Hide resolved
src/overrides.jl Outdated
newg.weights = new_weights
for e in edges(newg)
if e ∉ elist
newg.weights[dst(e), src(e)] = 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is not gonna work because the matrix new_weights has new indexing due to the removal of many vertices

Copy link
Contributor Author

@pgrepds pgrepds Mar 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review. I have reimplemented the function and added new tests!

src/overrides.jl Outdated Show resolved Hide resolved
test/simpleweightedgraph.jl Outdated Show resolved Hide resolved
test/simpleweightedgraph.jl Outdated Show resolved Hide resolved
test/simpleweightedgraph.jl Outdated Show resolved Hide resolved
@gdalle
Copy link
Member

gdalle commented Apr 6, 2023

@pgrepds can you merge the recent changes from the master branch into your PR?

@pgrepds
Copy link
Contributor Author

pgrepds commented Apr 11, 2023

@pgrepds can you merge the recent changes from the master branch into your PR?

Sorry for the late response. Yes, done!

src/overrides.jl Outdated Show resolved Hide resolved
@gdalle gdalle dismissed their stale review April 28, 2023 20:08

Outdated

@gdalle gdalle changed the title add induced_subgraph function for creating induced subgraph from edge… Create induced subgraph from edge list Apr 28, 2023
@gdalle gdalle merged commit 4d8e451 into JuliaGraphs:master Apr 28, 2023
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.

induced_subgraph does not preserve weights for edge lists.
3 participants