sketchgraphs.data.sequence¶
This module contains the implementation for the “sequence” projection of SketchGraphs.
The sequence projection (consisting of NodeOp
representing entities, and EdgeOp
representing constraints),
is a streamlined representation of sketches, adapted for machine learning applications.
Classes
|
This class represents an edge (or constraint) operation in a construction sequence. |
|
This class represents a node (or entity) operation in a construction sequence. |
Functions
-
sketchgraphs.data.sequence.
pgvgraph_from_sequence
(seq)¶ Builds a pgv.AGraph from the sequence.
Hyperedges are not supported in the resulting graph.
-
sketchgraphs.data.sequence.
sketch_from_sequence
(seq) → sketchgraphs.data.sketch.Sketch¶ Builds a Sketch object from the given sequence.
-
sketchgraphs.data.sequence.
sketch_to_sequence
(sketch, ignore_invalid_constraints=True) → List[Union[sketchgraphs.data.sequence.NodeOp, sketchgraphs.data.sequence.EdgeOp]]¶ Creates a sequence representation in terms of
NodeOp
andEdgeOp
from the given sketch.All the entities in the sketch are converted, along with the respective constraints. Constraints are expressed in terms of entity indices (instead of original string identifiers). The sequence is ordered such that the nodes are in original insertion order, and the edges are placed such that they directly follow the last node they reference.
- Parameters
- Returns
A list of construction operations
- Return type
- Raises
ValueError – If
ignore_invalid_constraints
is set to False, a ValueError will be raised upon encountering invalid constraints (e.g. constraints which refer to non-existing nodes, or whose parameters cannot be processed according to the specified schema).