Opened 6 years ago

Last modified 6 years ago

#18185 closed defect

Clean the Graph/DiGraph constructors — at Initial Version

Reported by: ncohen Owned by:
Priority: major Milestone: sage-6.7
Component: graph theory Keywords:
Cc: ncohen, sage-combinat, tmonteil, vdelecroix, dcoudert, darij Merged in:
Authors: Nathann Cohen Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: #18067 Stopgaps:

Status badges

Description

The Graph and DiGraph? constructor are rather long, and rather messy, as they are meant to accept a LOT of different inputs.

The point of this branch is to simplify its logic, in order to be able to split it into subfunctions later.

Here is the current logic: 1) Detect and set the 'format' if it was not specified 2) For every possible format, define whether the graph should allow loops/multiedges 3) Pick a data structure (i.e. backend) and create it 4) For every possible format, add vertices and edges

Besides local fixes and modifications, this branch moves '3' right after '1'. Then, '3' and '4' are merged so that we only enumerate all possible formats once.

I tried to split commits to make it easier to review. I know that it will not be very easy to read. It was not exactly easy to write either.

Change History (0)

Note: See TracTickets for help on using tickets.