Opened 3 years ago

Closed 21 months ago

#27513 closed enhancement (fixed)

Allow custom order for edges as well as vertices for incidence matrix

Reported by: kcrisman Owned by:
Priority: minor Milestone: sage-9.1
Component: graph theory Keywords:
Cc: Merged in:
Authors: David Coudert Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: 25da883 (Commits, GitHub, GitLab) Commit: 25da8838a73ecde89b0bbbd0aced7c5249e19f83
Dependencies: Stopgaps:

Status badges


See this SO question, where the question is how to use incidence_matrix in such a way as to order the vertices and the edges as desired. One can specify vertex order, but not edges.

Change History (11)

comment:1 Changed 2 years ago by dcoudert

To fill the matrix, we just need a mapping from edges to integers. That's the easy part.

The hard parts are

  • to check that the given list of edges is exactly the list of edges of the graph without sorting (Python 3)
  • to decide what to do if the input list of edges has labels (raise an error or consider only the vertices)
  • possibly to deal with multiple edges / loops. We can decide that the method works only for simple (di)graph

comment:2 Changed 2 years ago by dcoudert

  • Authors set to David Coudert
  • Branch set to public/graphs/27513_incidence_matrix
  • Commit set to 94ec80fe3ecd235591012243eb46842bbf5c478a
  • Status changed from new to needs_review

This should do the job. Note that edges are considered without labels. It is possible to change that if needed.

New commits:

94ec80ftrac #27513: allow to specify the order of edges in incidence_matrix

comment:3 Changed 2 years ago by git

  • Commit changed from 94ec80fe3ecd235591012243eb46842bbf5c478a to 25da8838a73ecde89b0bbbd0aced7c5249e19f83

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

25da883trac #27513: allow to give edges with labels

comment:4 Changed 2 years ago by dcoudert

You can now give edges with labels. This might ease the use of the method.

comment:5 Changed 2 years ago by embray

  • Milestone changed from sage-8.8 to sage-8.9

Moving tickets from the Sage 8.8 milestone that have been actively worked on in the last six months to the next release milestone (optimistically).

comment:6 Changed 2 years ago by dcoudert

This tickets is awaiting for review. Thanks.

comment:7 Changed 2 years ago by dcoudert

  • Milestone changed from sage-8.9 to sage-9.0

comment:8 Changed 23 months ago by dcoudert

green bot.

comment:9 Changed 21 months ago by dcoudert

  • Milestone changed from sage-9.0 to sage-9.1

comment:10 Changed 21 months ago by tscrim

  • Reviewers set to Travis Scrimshaw
  • Status changed from needs_review to positive_review


On a followup ticket, I might consider adding a check parameter to both this and the vertices input for the users who know what they are doing and need the extra speed.

Last edited 21 months ago by tscrim (previous) (diff)

comment:11 Changed 21 months ago by vbraun

  • Branch changed from public/graphs/27513_incidence_matrix to 25da8838a73ecde89b0bbbd0aced7c5249e19f83
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.