Opened 2 years ago

Closed 2 years ago

#27600 closed enhancement (fixed)

Adding parameter by_weight in min_spanning_tree()

Reported by: gh-rajat1433 Owned by: gh-rajat1433
Priority: major Milestone: sage-8.8
Component: graph theory Keywords:
Cc: dcoudert Merged in:
Authors: Rajat Mittal Reviewers: David Coudert
Report Upstream: N/A Work issues:
Branch: 9506749 (Commits, GitHub, GitLab) Commit: 9506749f97be7b95789bf448013953545d91fc89
Dependencies: Stopgaps:

Status badges

Description

Like in shortest_path we have parameters by_weight and weight_function to use the edge weights. But in min_spanning_tree we first have to do g.is_weighted(True) which is clearly an extra step to do. This ticket aims at unifying the usage of weights by introducing by_weight parameter in min_spanning_tree, if True, the edges in the graph will be weighted, otherwise all edges will have weight 1.

Change History (13)

comment:1 Changed 2 years ago by gh-rajat1433

  • Owner changed from (none) to gh-rajat1433

comment:2 Changed 2 years ago by gh-rajat1433

  • Branch set to u/gh-rajat1433/27600_adding_by_weight
  • Reviewers set to David Coudert

comment:3 Changed 2 years ago by git

  • Commit set to 44abe7e009bc36a1f9beb2d5deb0b7ad41c5933c

Branch pushed to git repo; I updated commit sha1. New commits:

comment:4 Changed 2 years ago by git

  • Commit changed from 44abe7e009bc36a1f9beb2d5deb0b7ad41c5933c to fb7565e74ce50640956c4801d8a4117516c2d30a

Branch pushed to git repo; I updated commit sha1. New commits:

fb7565eadded by_weight

comment:5 Changed 2 years ago by gh-rajat1433

I have pushed the code with the proposed addition of a parameter by_weight.

comment:6 Changed 2 years ago by git

  • Commit changed from fb7565e74ce50640956c4801d8a4117516c2d30a to 8e0b3ef1d8bcca4c0630037f60f43c5b5a8ebb20

Branch pushed to git repo; I updated commit sha1. New commits:

8e0b3efremoved space

comment:7 Changed 2 years ago by gh-rajat1433

  • Status changed from new to needs_review

comment:8 Changed 2 years ago by git

  • Commit changed from 8e0b3ef1d8bcca4c0630037f60f43c5b5a8ebb20 to 35d71ba15c5fec327f87ea2a60fdad8dcd046ea0

Branch pushed to git repo; I updated commit sha1. New commits:

35d71baimproved code for netwrokx usage

comment:9 Changed 2 years ago by gh-rajat1433

I have fixed error msg and improved networkx'x usage too.

comment:10 Changed 2 years ago by dcoudert

no need to create the list E = list(networkx.minimum_spanning_edges(G, data=False)). E can be an iterator.

comment:11 Changed 2 years ago by git

  • Commit changed from 35d71ba15c5fec327f87ea2a60fdad8dcd046ea0 to 9506749f97be7b95789bf448013953545d91fc89

Branch pushed to git repo; I updated commit sha1. New commits:

9506749removed list

comment:12 Changed 2 years ago by dcoudert

  • Status changed from needs_review to positive_review

LGTM

comment:13 Changed 2 years ago by vbraun

  • Branch changed from u/gh-rajat1433/27600_adding_by_weight to 9506749f97be7b95789bf448013953545d91fc89
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.