Skip to content

Commit

Permalink
Constructor: Support LinearMatroid representation with labels=True
Browse files Browse the repository at this point in the history
Also get groundset labels
  • Loading branch information
gmou3 committed May 7, 2024
1 parent 796dd16 commit 49ad4fb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/sage/matroids/constructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,8 @@ def Matroid(groundset=None, data=None, **kwds):
Graph = ()
if isinstance(data, Graph):
key = 'graph'
elif is_Matrix(data):
elif is_Matrix(data) or (
isinstance(data, tuple) and is_Matrix(data[0])):
key = 'matrix'
elif isinstance(data, sage.modules.with_basis.morphism.ModuleMorphism) or (
isinstance(data, tuple) and
Expand Down Expand Up @@ -906,10 +907,11 @@ def Matroid(groundset=None, data=None, **kwds):
# Matrices:
elif key in ['matrix', 'reduced_matrix', 'morphism', 'reduced_morphism']:
A = data
if isinstance(data, tuple):
A = data[0]
groundset = data[1]
is_reduced = (key == 'reduced_matrix' or key == 'reduced_morphism')
if key == 'morphism' or key == 'reduced_morphism':
if isinstance(data, tuple):
A = data[0]
if groundset is None:
groundset = list(A.domain().basis().keys())
if is_reduced:
Expand Down

0 comments on commit 49ad4fb

Please sign in to comment.