Overview
Currently, the following data structures are implemented:
from pyTooling.Graph import Graph
graph = Graph(name="Example Graph")
# Create a standalone vertex A in the graph
rootA = Vertex(value="A", graph=graph)
# Add 2 vertices B,C and add edges from A
edgeAB = rootA.EdgeToNewVertex(vertexValue="B")
edgeAC = rootA.EdgeToNewVertex(vertexValue="C")
# Get vertices B,C
vertexB = edgeAB.Destination
vertexC = edgeAC.Destination
# Add more standalone vertices D,E,F,G
vertexD = Vertex(value="D", graph=graph)
vertexE = Vertex(value="E", graph=graph)
vertexF = Vertex(value="F", graph=graph)
vertexG = Vertex(value="G", graph=graph)
# Create edges between B-E,C-G,D-A,D-B
vertexB.EdgeTo(vertexE)
vertexC.EdgeTo(vertexG)
vertexD.EdgeTo(rootA)
vertexD.EdgeTo(vertexB)
vertexE.EdgeTo(vertexF)
vertexF.EdgeTo(vertexB)
vertexG.EdgeTo(vertexF)
# Create edge from
vertexD.EdgeFrom(vertexF)
# Add vertex I,H and add edge from new vertex to existing
vertexE.EdgeFromNewVertex(vertexValue="I")
vertexD.EdgeFromNewVertex(vertexValue="H")
# Lookup vertices and link them
vertexG.EdgeTo(graph.GetVertexByValue("H"))
|
from pyTooling.Tree import Node
root = Node(id="Root")
dir1 = Node(id="Dir1", parent=root)
dir2 = Node(id="Dir2", parent=root)
file0 = Node(id="File0", parent=root)
dir3 = Node(id="Dir3", parent=root)
file1 = Node(id="File1", parent=dir1)
file2 = Node(id="File2", parent=dir1)
file3 = Node(id="File3", parent=dir1)
file4 = Node(id="File4", parent=dir2)
file5 = Node(id="File5", parent=dir3)
file6 = Node(id="File6", parent=dir3)
|
from pyTooling.StateMachine import FSM, State
|