unlisted
ubuntu2004a
��c�� � @ s� d dl mZ d dlmZ d dlmZ d dlmZ d dlm Z d dl
mZ d dlm
Z
d dlmZ d d lmZ d d
lmZ d dlmZ G dd
� d
e�ZdS )� )�deepcopy)�
SageObject)�ZZ)�flatten)�sign)�
cached_method)�Graph)�text)� GraphIsom)�StableGraph)�
kSignaturec @ s� e Zd ZdZd�dd�Zed�dd��Zdd� Zd d
� Zdd� Z d
d� Z
dd� Zedd� �Z
edd� �Zed�dd��Zedd� �Zedd� �Zedd� �Zedd� �Zed d!� �Zed"d#� �Zed$d%� �Zed&d'� �Zed(d)� �Zed*d+� �Zed,d-� �Zed.d/� �Zed�d0d1��Zed2d3� �Zd4d5� Zed6d7� �Z ed8d9� �Z!ed:d;� �Z"ed<d=� �Z#ed>d?� �Z$ed@dA� �Z%edBdC� �Z&edDdE� �Z'edFdG� �Z(ed�dHdI��Z)edJdK� �Z*edLdM� �Z+edNdO� �Z,edPdQ� �Z-edRdS� �Z.edTdU� �Z/ed�dVdW��Z0ed�dXdY��Z1ed�dZd[��Z2ed�d\d]��Z3d^d_� Z4d`da� Z5dbdc� Z6ddde� Z7dfdg� Z8dhdi� Z9djdk� Z:dldm� Z;dndo� Z<d�dpdq�Z=d�dsdt�Z>d�dudv�Z?d�dwdx�Z@dydz� ZAd{d|� ZBd}d~� ZCdd�� ZDd�d�� ZEd�d�d��ZFd�d�� ZGdS )��KLevelGrapha�
Create a (stable) level graph for a k-differential.
.. NOTE::
This is a low-level class and should NEVER be invoked directly!
Preferably, ``EmbeddedLevelGraphs`` should be used and these should be
generated automatically by ``Stratum`` (or ``GeneralisedStratum``).
.. NOTE::
We do not inherit from stgraph/StableGraph anymore, as KLevelGraphs
should be static objects!
Extends admcycles stgraph to represent a level graph as a stgraph,
i.e. a list of genera, a list of legs and a list of edges, plus a list of
poleorders for each leg and a list of levels for each vertex.
Note that the class will warn if the data is not admissible, i.e. if the
graph is not stable or the pole orders at separating nodes across levels do
not add up to -2 or -1 on the same level (unless this is suppressed with
quiet=True).
INPUT:
genera : list
List of genera of the vertices of length m.
legs : list
List of length m, where ith entry is list of legs attached to vertex i.
By convention, legs are unique positive integers.
edges : list
List of edges of the graph. Each edge is a 2-tuple of legs.
poleorders : dictionary
Dictionary of the form leg number : poleorder
levels : list
List of length m, where the ith entry corresponds to the level of
vertex i.
By convention, top level is 0 and levels go down by 1, in particular
they are NEGATIVE numbers!
k : int
The order of the differential.
quiet : optional boolean (default = False)
Suppresses most error messages.
ALTERNATIVELY, the pole orders can be supplied as a list by calling
KLevelGraph.fromPOlist:
poleorders : list
List of order of the zero (+) or pole (-) at each leg. The ith element
of the list corresponds to the order at the leg with the marking i+1
(because lists start at 0 and the legs are positive integers).
EXAMPLES:
Creating a level graph with three components on different levels of genus 1,
3 and 0. The bottom level has a horizontal node.::
sage: from admcycles.diffstrata.klevelgraph import KLevelGraph
sage: G = KLevelGraph.fromPOlist([1,3,0],[[1,2],[3,4,5],[6,7,8,9]],[(2,3),(5,6),(7,8)],[2,-2,0,6,-2,0,-1,-1,0],[-2,-1,0],1); G # doctest: +SKIP
KLevelGraph([1, 3, 0],[[1, 2], [3, 4, 5], [6, 7, 8, 9]],[(3, 2), (6, 5), (7, 8)],{1: 2, 2: -2, 3: 0, 4: 6, 5: -2, 6: 0, 7: -1, 8: -1, 9: 0},[-2, -1, 0],1,True)
or alternatively::
sage: KLevelGraph([1, 3, 0],[[1, 2], [3, 4, 5], [6, 7, 8, 9]],[(3, 2), (6, 5), (7, 8)],{1: 2, 2: -2, 3: 0, 4: 6, 5: -2, 6: 0, 7: -1, 8: -1, 9: 0},[-2, -1, 0],1,quiet=True)
KLevelGraph([1, 3, 0],[[1, 2], [3, 4, 5], [6, 7, 8, 9]],[(3, 2), (6, 5), (7, 8)],{1: 2, 2: -2, 3: 0, 4: 6, 5: -2, 6: 0, 7: -1, 8: -1, 9: 0},[-2, -1, 0],1,True)
Creating a level graph with two components on different levels of genus 1 and 1 and a quadratic differential.::
sage: KLevelGraph.fromPOlist([1,1],[[1],[2,3]],[(1,2)],[0,-4,4],[0,-1],2)
KLevelGraph([1, 1],[[1], [2, 3]],[(1, 2)],{1: 0, 2: -4, 3: 4},[0, -1],2,True)
We get a warning if the graph has non-stable components: (not any more ;-))::
sage: G = KLevelGraph.fromPOlist([1,3,0,0],[[1,2],[3,4,5],[6,7,8,9],[10]],[(2,3),(5,6),(7,8),(9,10)],[2,-2,0,6,-2,0,-1,-1,0,-2],[-3,-2,0,-1],1); G # doctest: +SKIP
Warning: Component 3 is not stable: g = 0 but only 1 leg(s)!
Warning: Graph not stable!
KLevelGraph([1, 3, 0, 0],[[1, 2], [3, 4, 5], [6, 7, 8, 9], [10]],[(3, 2), (6, 5), (7, 8), (9, 10)],{1: 2, 2: -2, 3: 0, 4: 6, 5: -2, 6: 0, 7: -1, 8: -1, 9: 0, 10: -2},[-3, -2, 0, -1],1,True)
Fc
s� d}t |�t |�krtd��|| _|| _|| _� | _|| _t� fdd�| �� D ��} t | |�| _
d | _| �� |r|| �
|� d | _i | _d | _d S )NFz)genera and legs must have the same lengthc 3 s | ]}� | V qd S �N� ��.0�l��
poleordersr �D/home/user/Introduction lectures/admcycles/diffstrata/klevelgraph.py� <genexpr>p � z'KLevelGraph.__init__.<locals>.<genexpr>)�len�
ValueError�genera�legs�edgesr �levels�tuple�
list_markingsr �sig�_stgraph�
_init_more�checkadmissible�_has_long_edge�_is_long�_is_bic)
�selfr r r r r �k�quiet�checks�sig_listr r r �__init__e s"