Opened 2 years ago

Closed 16 months ago

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

Reported by: Owned by: kcrisman minor sage-9.1 graph theory David Coudert Travis Scrimshaw N/A 25da883 25da8838a73ecde89b0bbbd0aced7c5249e19f83

### Description

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.

### 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:

 ​94ec80f `trac #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:

 ​25da883 `trac #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 22 months 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 22 months ago by dcoudert

This tickets is awaiting for review. Thanks.

### comment:7 Changed 19 months ago by dcoudert

• Milestone changed from sage-8.9 to sage-9.0

green bot.

### comment:9 Changed 16 months ago by dcoudert

• Milestone changed from sage-9.0 to sage-9.1

### comment:10 Changed 16 months ago by tscrim

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

LGTM.

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

Version 0, edited 16 months ago by tscrim (next)

### comment:11 Changed 16 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.