pyecsca.ec.formula.graph module

Provides tools for working with formulas as graphs.

class Node[source]

Bases: ABC

abstract property label: str
abstract property result: str
property is_sub: bool
property is_mul: bool
property is_add: bool
property is_id: bool
property is_sqr: bool
property is_pow: bool
property is_inv: bool
property is_div: bool
property is_neg: bool
reconnect_outgoing_nodes(destination)[source]
class ConstantNode(i)[source]

Bases: Node

color = '#b41f44'
property label: str
property result: str
property is_add: bool
property is_div: bool
property is_id: bool
property is_inv: bool
property is_mul: bool
property is_neg: bool
property is_pow: bool
property is_sqr: bool
property is_sub: bool
reconnect_outgoing_nodes(destination)
class InputNode(input)[source]

Bases: Node

color = '#b41f44'
property label: str
property result: str
property is_add: bool
property is_div: bool
property is_id: bool
property is_inv: bool
property is_mul: bool
property is_neg: bool
property is_pow: bool
property is_sqr: bool
property is_sub: bool
reconnect_outgoing_nodes(destination)
class FormulaGraph(formula, rename=True)[source]

Bases: object

name: str
shortname: str
parameters: List[str]
assumptions: List[Expression]
coordinate_model: Any
output_names: Set[str]
input_nodes: MutableMapping[str, InputNode]
roots: List[Node]
nodes: List[Node]
node_index(node)[source]
Return type:

int

deepcopy()[source]
to_formula(name=None)[source]
Return type:

CodeFormula

networkx_graph()[source]
Return type:

DiGraph

levels()[source]
Return type:

List[List[Node]]

output_nodes()[source]
Return type:

List[Node]

planar_positions()[source]
Return type:

Dict[int, Tuple[float, float]]

draw(filename=None, figsize=(12, 12))[source]
find_all_paths()[source]
Return type:

List[List[Node]]

reorder()[source]
remove_node(node)[source]
add_node(node)[source]
reindex()[source]
update()[source]
print()[source]