Stability

pybel_tools.analysis.stability.get_contradiction_summary(graph)[source]

Yield triplets of (source node, target node, set of relations) for (source node, target node) pairs that have multiple, contradictory relations.

Parameters:graph (pybel.BELGraph) – A BEL graph
Return type:iter[tuple]
pybel_tools.analysis.stability.get_regulatory_pairs(graph)[source]

Finds pairs of nodes that have mutual causal edges that are regulating each other such that A -> B and B -| A.

Parameters:graph (pybel.BELGraph) – A BEL graph
Returns:A set of pairs of nodes with mutual causal edges
Return type:set
pybel_tools.analysis.stability.get_chaotic_pairs(graph)[source]

Finds pairs of nodes that have mutual causal edges that are increasing each other such that A -> B and B -> A.

Parameters:graph (pybel.BELGraph) – A BEL graph
Returns:A set of pairs of nodes with mutual causal edges
Return type:set
pybel_tools.analysis.stability.get_dampened_pairs(graph)[source]

Finds pairs of nodes that have mutual causal edges that are decreasing each other such that A -| B and B -| A.

Parameters:graph (pybel.BELGraph) – A BEL graph
Returns:A set of pairs of nodes with mutual causal edges
Return type:set
pybel_tools.analysis.stability.get_correlation_graph(graph)[source]

Extracts a graph of only correlative relationships

Parameters:graph (pybel.BELGraph) – A BEL Graph
Return type:networkx.Graph
pybel_tools.analysis.stability.get_correlation_triangles(graph)[source]

Returns a set of all triangles pointed by the given node

Parameters:graph (networkx.Graph) – A non-directional graph
Return type:set[tuple]
pybel_tools.analysis.stability.get_triangles(graph)[source]

Gets a set of triples representing the 3-cycles from a directional graph. Each 3-cycle is returned once, with nodes in sorted order.

Parameters:graph (networkx.DiGraph) – A directional graph
Return type:set[tuple]
pybel_tools.analysis.stability.get_separate_unstable_correlation_triples(graph)[source]

Yields all triples of nodes A, B, C such that A positiveCorrelation B, A positiveCorrelation C, and B negativeCorrelation C

Parameters:graph (pybel.BELGraph) – A BEL graph
Returns:An iterator over triples of unstable graphs, where the second two are negative
Return type:iter[tuple]
pybel_tools.analysis.stability.get_mutually_unstable_correlation_triples(graph)[source]

Yields all triples of nodes A, B, C such that A negativeCorrelation B, B negativeCorrelation C, and C negativeCorrelation A.

Parameters:graph (pybel.BELGraph) – A BEL graph
Return type:iter[tuple]
pybel_tools.analysis.stability.jens_transformation_alpha(graph)[source]

Applies Jens’ transformation (Type 1) to the graph

  1. Induce a subgraph over causal + correlative edges
  2. Transform edges by the following rules:
    • increases => increases
    • decreases => backwards increases
    • positive correlation => two way increases
    • negative correlation => delete

The resulting graph can be used to search for 3-cycles, which now symbolize unstable triplets where A -> B, A -| C and B positiveCorrelation C.

Parameters:graph (pybel.BELGraph) – A BEL graph
Return type:networkx.DiGraph
pybel_tools.analysis.stability.jens_transformation_beta(graph)[source]

Applies Jens’ Transformation (Type 2) to the graph

  1. Induce a subgraph over causal and correlative relations
  2. Transform edges with the following rules:
    • increases => backwards decreases
    • decreases => decreases
    • positive correlation => delete
    • negative correlation => two way decreases

The resulting graph can be used to search for 3-cycles, which now symbolize stable triples where A -> B, A -| C and B negativeCorrelation C.

Parameters:graph (pybel.BELGraph) – A BEL graph
Return type:networkx.DiGraph
pybel_tools.analysis.stability.get_jens_unstable(graph)[source]

Yields triples of nodes where A -> B, A -| C, and C positiveCorrelation A. Calculated efficiently using the Jens Transformation.

Parameters:graph (pybel.BELGraph) – A BEL graph
Returns:An iterable of triplets of nodes
Return type:iter[tuple]
pybel_tools.analysis.stability.get_increase_mismatch_triplets(graph)[source]

Iterates over triples of nodes where A -> B, A -> C, and C negativeCorrelation A.

Parameters:graph (pybel.BELGraph) – A BEL graph
Returns:An iterable of triplets of nodes
Return type:iter[tuple]
pybel_tools.analysis.stability.get_decrease_mismatch_triplets(graph)[source]

Iterates over triplets of nodes where A -| B, A -| C, and C negativeCorrelation A.

Parameters:graph (pybel.BELGraph) – A BEL graph
Returns:An iterable of triplets of nodes
Return type:iter[tuple]
pybel_tools.analysis.stability.get_chaotic_triplets(graph)[source]

Iterates over triples of nodes that mutually increase each other, such as when A -> B, B -> C, and C -> A.

Parameters:graph (pybel.BELGraph) – A BEL graph
Returns:An iterable of triplets of nodes
Return type:iter[tuple]
pybel_tools.analysis.stability.get_dampened_triplets(graph)[source]

Iterates over triples of nodes that mutually decreases each other, such as when A -| B, B -| C, and C -| A.

Parameters:graph (pybel.BELGraph) – A BEL graph
Returns:An iterable of triplets of nodes
Return type:iter[tuple]