-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathP6.py
30 lines (26 loc) · 1020 Bytes
/
P6.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from typing import List
from Graph import Graph
from Production import Production
from Vertex import Vertex
class P6(Production):
@staticmethod
def apply(vertices: List[Vertex], graph: Graph):
if vertices[0].label == 'Z':
new_vertex_f_index = len(graph.vertices)
graph.create_add_vertex('F')
graph.create_add_edge('d', vertices[0],
graph.vertices[new_vertex_f_index])
graph.create_add_edge('d', graph.vertices[new_vertex_f_index],
graph.create_add_vertex('P'))
graph.create_add_edge('d', graph.vertices[new_vertex_f_index],
graph.create_add_vertex('P'))
@staticmethod
def description() -> str:
return ('name: P6\n'
'L: (Z)\n'
"""P: (Z) --d--> (F) --d--> (P)
\\---d---> (P)\n"""
'c: {CopyRest}\n')
@staticmethod
def to_string():
return "P6"