Node-edge graphs (indra.assemblers.graph.assembler) — INDRA 1.22.0 documentation (original) (raw)
class indra.assemblers.graph.assembler.GraphAssembler(stmts=None, graph_properties=None, node_properties=None, edge_properties=None)[source]
The Graph assembler assembles INDRA Statements into a Graphviz node-edge graph.
Parameters
- stmts (Optional _[_list[ indra.statements.Statement ] ]) – A list of INDRA Statements to be added to the assembler’s list of Statements.
- graph_properties (Optional _[_dict[ str: str ] ]) – A dictionary of graphviz graph properties overriding the default ones.
- node_properties (Optional _[_dict[ str: str ] ]) – A dictionary of graphviz node properties overriding the default ones.
- edge_properties (Optional _[_dict[ str: str ] ]) – A dictionary of graphviz edge properties overriding the default ones.
statements
A list of INDRA Statements to be assembled.
Type
list[indra.statements.Statement]
graph
A pygraphviz graph that is assembled by this assembler.
Type
pygraphviz.AGraph
existing_nodes
The list of nodes (identified by node key tuples) that are already in the graph.
Type
existing_edges
The list of edges (identified by edge key tuples) that are already in the graph.
Type
graph_properties
A dictionary of graphviz graph properties used for assembly.
Type
dict[str: str]
node_properties
A dictionary of graphviz node properties used for assembly.
Type
dict[str: str]
edge_properties
A dictionary of graphviz edge properties used for assembly. Note that most edge properties are determined based on the type of the edge by the assembler (e.g. color, arrowhead). These settings cannot be directly controlled through the API.
Type
dict[str: str]
add_statements(stmts)[source]
Add a list of statements to be assembled.
Parameters
stmts (list[ indra.statements.Statement ]) – A list of INDRA Statements to be appended to the assembler’s list.
Return the assembled graph as a string.
Returns
graph_string – The assembled graph as a string.
Return type
Assemble the graph from the assembler’s list of INDRA Statements.
save_dot(file_name='graph.dot')[source]
Save the graph in a graphviz dot file.
Parameters
file_name (Optional _[_str]) – The name of the file to save the graph dot string to.
save_pdf(file_name='graph.pdf', prog='dot')[source]
Draw the graph and save as an image or pdf file.
Parameters