Package tulip :: Package transys :: Module machines :: Class Transducer
[frames] | no frames]

Class Transducer


Sequential Transducer, i.e., a letter-to-letter function.

Inputs

P = {p1, p2,...} is the set of input ports. An input port p takes values in a set Vp. Set Vp is called the "type" of input port p. A "valuation" is an assignment of values to the input ports in P.

We call "inputs" the set of pairs:

 {(p_i, Vp_i),...}

of input ports p_i and their corresponding types Vp_i.

A guard is a predicate (bool-valued) used as sub-label for a transition. A guard is defined by a set and evaluated using set membership. So given an input port value p=x, then if:

 x \in guard_set

then the guard is True, otherwise it is False.

The "inputs" are defined by an OrderedDict:

 {'p1':explicit, 'p2':check, 'p3':None, ...}

where:

Guards annotate transitions:

 Guards: States x States ---> Input_Predicates

Outputs

Similarly defined to inputs, but:

State Variables

Similarly defined to inputs, they annotate states, for both Mealy and Moore machines:

 States ---> State_Variables

Update Function

The transition relation:

Note

A transducer may operate on either finite or infinite words, i.e., it is not equipped with interpretation semantics on the words, so it does not "care" about word length. It continues as long as its input is fed with letters.

For Machines, each state label consists of (possibly multiple) sublabels, each of which is either a variable, or, only for Moore machines, may be an output.

See Also

FSM, MealyMachine, MooreMachine

Nested Classes

Inherited from networkx.classes.multigraph.MultiGraph: edge_key_dict_factory

Inherited from networkx.classes.graph.Graph: adjlist_dict_factory, edge_attr_dict_factory, node_dict_factory

Instance Methods
 
__init__(self)
Initialize a graph with edges, name, graph attributes.
 
add_inputs(self, new_inputs, masks=None)
Create new inputs.
 
add_state_vars(self, new_state_vars)

Inherited from labeled_graphs.LabeledDiGraph: add_edge, add_edges_from, add_node, add_nodes_from, dot_str, has_deadends, is_consistent, plot, remove_deadends, remove_labeled_edge, remove_labeled_edges_from, save

Inherited from networkx.classes.multidigraph.MultiDiGraph: degree_iter, edges_iter, in_degree_iter, in_edges, in_edges_iter, is_directed, is_multigraph, out_degree_iter, out_edges, out_edges_iter, remove_edge, reverse, subgraph, to_directed, to_undirected

Inherited from networkx.classes.multigraph.MultiGraph: edges, get_edge_data, has_edge, number_of_edges, remove_edges_from, selfloop_edges

Inherited from networkx.classes.digraph.DiGraph: clear, has_predecessor, has_successor, in_degree, neighbors, neighbors_iter, out_degree, predecessors, predecessors_iter, remove_node, remove_nodes_from, successors, successors_iter

Inherited from networkx.classes.graph.Graph: __contains__, __getitem__, __iter__, __len__, __str__, add_cycle, add_path, add_star, add_weighted_edges_from, adjacency_iter, adjacency_list, copy, degree, has_node, nbunch_iter, nodes, nodes_iter, nodes_with_selfloops, number_of_nodes, number_of_selfloops, order, size

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Properties

Inherited from networkx.classes.graph.Graph: name

Inherited from object: __class__

Method Details

__init__(self)
(Constructor)

 
Initialize a graph with edges, name, graph attributes.

Parameters
----------
data : input graph
    Data to initialize graph.  If data=None (default) an empty
    graph is created.  The data can be an edge list, or any
    NetworkX graph object.  If the corresponding optional Python
    packages are installed the data can also be a NumPy matrix
    or 2d ndarray, a SciPy sparse matrix, or a PyGraphviz graph.
name : string, optional (default='')
    An optional name for the graph.
attr : keyword arguments, optional (default= no attributes)
    Attributes to add to graph as key=value pairs.

See Also
--------
convert

Examples
--------
>>> G = nx.Graph()   # or DiGraph, MultiGraph, MultiDiGraph, etc
>>> G = nx.Graph(name='my graph')
>>> e = [(1,2),(2,3),(3,4)] # list of edges
>>> G = nx.Graph(e)

Arbitrary graph attribute pairs (key=value) may be assigned

>>> G=nx.Graph(e, day="Friday")
>>> G.graph
{'day': 'Friday'}

Overrides: object.__init__
(inherited documentation)

add_inputs(self, new_inputs, masks=None)

 

Create new inputs.

Parameters:
  • new_inputs (dict) - dict of pairs {port_name : port_type} where:
    • port_name: str
    • port_type: Iterable | check class
  • masks (dict of functions {port_name : mask_function} each mask_function returns bool) - custom mask functions, for each sublabel based on its current value each such function returns:
    • True, if the sublabel should be shown
    • False, otherwise (to hide it)