pyphi.graph#

Bridge between PyPhi value types and graph representations.

Exports static structure (directed graphs over the TPM-inferred causal connectivity, FactoredTPM.infer_cm; pass connectivity="declared" to use the substrate’s declared connectivity matrix verbatim) and dynamics (the two-timeslice dynamic Bayesian network export, which carries each unit’s conditional probability distribution over its inferred parents).

Functions

in_degree(substrate[, connectivity])

In-degree per node index.

is_dag(substrate[, connectivity])

Whether the substrate graph is acyclic.

is_strongly_connected(substrate[, connectivity])

Whether the substrate graph is strongly connected (a complex must be).

out_degree(substrate[, connectivity])

Out-degree per node index.

simple_cycles(substrate[, connectivity])

All simple cycles as lists of node indices.

strongly_connected_components(substrate[, ...])

Strongly connected components as tuples of node indices.

substrate_from_networkx(graph, tpm, *[, ...])

Build a Substrate from a DiGraph topology plus a TPM.

substrate_to_dbn(substrate)

Return the substrate's 2-timeslice DBN as a networkx.DiGraph.

substrate_to_dbn_dict(substrate)

Return the substrate's 2-timeslice DBN as a plain dict.

substrate_to_networkx(substrate[, connectivity])

Return a node-labeled directed graph over the substrate's connectivity.

system_to_networkx(system[, connectivity])

Return the substrate graph with per-node state and membership attributes.

to_adjacency(substrate[, connectivity])

Return the chosen connectivity matrix as a node-labeled DataFrame.

to_graphml(substrate, path[, connectivity])

Write the substrate graph to a GraphML file.