pyecsca.ec.formula.graph module

Provides tools for working with formulas as graphs.

class Node[source]

Bases: ABC

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

Bases: Node

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

Bases: Node

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

Bases: object

name: str[source]
shortname: str[source]
parameters: List[str][source]
assumptions: List[Expression][source]
coordinate_model: Any[source]
output_names: Set[str][source]
input_nodes: MutableMapping[str, InputNode][source]
roots: List[Node][source]
nodes: List[Node][source]
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]