jaxley.modules.base.to_graph#
- to_graph(module, synapses=False, channels=False)[source]#
Export a jx.Module as a networkX compartment graph.
Constructs a nx.DiGraph from the module. Each compartment in the module is represented by a node in the graph. The edges between the nodes represent the connections between the compartments. These edges can either be connections between compartments within the same branch, between different branches or even between different cells. In the latter case the synapse parameters are stored as edge attributes. Only function allows one synapse per edge! Additionally, global attributes of the module, for example ncomp, are stored as graph attributes.
Exported graphs can be imported again to jaxley using the from_graph method.
- Parameters:
- Returns:
A networkx compartment. Has the same structure as a graph built with build_compartment_graph().
- Return type:
nx.DiGraph
Example usage
cell = jx.read_swc("path_to_swc.swc", ncomp=1) comp_graph = to_graph(cell)