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

Meta-ticket: Unify the use of weights in graphs #13112

Open
dkrenn opened this issue Jun 13, 2012 · 15 comments
Open

Meta-ticket: Unify the use of weights in graphs #13112

dkrenn opened this issue Jun 13, 2012 · 15 comments

Comments

@dkrenn
Copy link
Contributor

dkrenn commented Jun 13, 2012

Consider the following example:

G = Graph([(1,2,0.1), (2,3,0.5), (1,3,0.3), (1,4,0.1)])  # whatever
G.min_spanning_tree(weight_function=lambda e:e[2])
w, L = T.longest_path(use_edge_labels=True)

In the last two lines, the functions are called differently, which is annoying, since one always has to look up the doc, to find out, which one is the correct.

Since both ways of calling are good (use_edge_labels simple and easy, weight_function more flexible), either should be possible for each function.

A first step is to unify the use of parameters by_weight, weight_function and check_weight

We also have to deprecate use_edge_labels and use instead by_weight, etc.

and check methods silently using if self.weighted()

CC: @sagetrac-brunellus @fchapoton @tscrim

Component: graph theory

Keywords: weight graph

Issue created by migration from https://trac.sagemath.org/ticket/13112

@sagetrac-brunellus
Copy link
Mannequin

sagetrac-brunellus mannequin commented Oct 1, 2012

comment:1

Moreover, there are arguments named "by_weight" in distance, shortest_path, shortest_path_length…

@sagetrac-brunellus
Copy link
Mannequin

sagetrac-brunellus mannequin commented Oct 1, 2012

comment:3

I would go for single argument "by_weight" with following semantics of its values:

  • False would be default with meaning "all the same".
  • True would use labels.
  • Custom function would be used translate edges to weight.

I think this would be easy to remember. On the other side, it is quite a radical change that would require long transition period.

What do you think?

@jdemeyer jdemeyer modified the milestones: sage-5.11, sage-5.12 Aug 13, 2013
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@dcoudert
Copy link
Contributor

comment:8

I'm turning this ticket to a task since it requires a long transition period.

@dcoudert

This comment has been minimized.

@dcoudert dcoudert modified the milestones: sage-6.4, sage-9.5 Oct 30, 2021
@dcoudert dcoudert changed the title inconsistency calling functions for weighted graphs Unify the use of weights in graphs Oct 30, 2021
@dcoudert

This comment has been minimized.

@dcoudert

This comment has been minimized.

@dcoudert dcoudert changed the title Unify the use of weights in graphs Task: Unify the use of weights in graphs Oct 30, 2021
@dcoudert

This comment has been minimized.

@dcoudert

This comment has been minimized.

@dcoudert

This comment has been minimized.

@dcoudert

This comment has been minimized.

@dcoudert

This comment has been minimized.

@dcoudert dcoudert changed the title Task: Unify the use of weights in graphs Meta-Ticket: Unify the use of weights in graphs Nov 8, 2021
@dcoudert

This comment has been minimized.

@dcoudert
Copy link
Contributor

comment:16

Help is more than welcome for reviewing the open tickets listed in this meta-ticket.

@mkoeppe mkoeppe modified the milestones: sage-9.5, sage-9.6 Dec 18, 2021
@dcoudert

This comment has been minimized.

@mkoeppe mkoeppe modified the milestones: sage-9.6, sage-9.7 Apr 11, 2022
@dcoudert

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants