unlisted
ubuntu2004o
��c� � @ s� d Z ddlmZ ddlZddlmZ ddlmZ ddlmZm Z ddl
mZmZ ddl
mZ dd lmZ d
dlmZ d
dlmZmZmZmZmZmZ ee d
d
dd�Ze�� ZG dd� d�Zdd� Zd>dd�Zd>dd�Z d>dd�Z!efdd�Z"efdd�Z#dd � Z$d!efd"d#�Z%d!efd$d%�Z&d!efd&d'�Z'd!efd(d)�Z(ed!efd*d+��Z)ed!efd,d-��Z*ed!efd.d/��Z+ed!efd0d1��Z,ed!efd2d3��Z-ed!efd4d5��Z.ed!efd6d7��Z/ed!efd8d9��Z0defd:d;�Z1ed!efd<d=��Z2dS )?z�
Generators of tautological ring
Each generator is called a stratum and is encoded in a class class:`Graph`. A
stratum is called *pure* if it has neither kappa nor psi marking (ie a stable
graph with no decoration).
� )�copyN)�cached_function)�lazy_attribute)�PolynomialRing�ZZ)�IntegerVectors�
Partitions)�floor)�matrix� )�aut)� MODULI_SM� MODULI_RT� MODULI_CT� MODULI_ST�MODULI_SMALL�dim_form�lex)�X)�order�namesc @ s� e Zd ZdZd&dd�Zdd� Zedd� �Zed d
� �Zdd� Z d
d� Z
dd� Zdd� Zdd� Z
d'dd�Zdd� Zdd� Zdd� Zdd� Zd d!� Zd"d#� Zd$d%� ZdS )(�Grapha�
A decorated graph representing a tautological class.
The graph is encoded as a matrix where
- each row after the first one corresponds to a vertex
- each column after the first one corresponds to an edge or leg
- the first column gives the genera of the vertices
- the first row gives the markings on the legs
- the other cells are
- 0 if the vertex and edge/leg are not incident
- 1 if the vertex and edge/leg are incident once
- 2 if the edge is a loop at the vertex
- entries with polynomials in X describe kappa/psi decorations:
- in the first column, each X^n term corresponds to a kappa_n at that
vertex
- in other locations, each X term corresponds to a psi at that half-edge
- at loops, 2 + aX + bX^2 corresponds to having psi^a on one side of the
loop and psi^b on the other
EXAMPLES::
sage: from admcycles.DR.graph import Graph, X
sage: gr = Graph(matrix(2, 3, [-1, 1, 2, 1, X + 1, 1]))
sage: gr
[ -1 1 2]
[ 1 X + 1 1]
sage: gr.num_vertices()
1
sage: gr.num_edges()
2
Nc C sL |r t |�| _d S |rttt|�d ddg| �| _d S ttddd�| _d S )Nr �����)r �Mr
�R�len)�selfr Z
genus_list� r �6/home/user/Introduction lectures/admcycles/DR/graph.py�__init__<