IMP logo
IMP Reference Guide  2.22.0
The Integrative Modeling Platform
IMP.spatiotemporal.score_graph Namespace Reference

Functions to traverse and score the spatiotemporal graphs. More...

Detailed Description

Functions to traverse and score the spatiotemporal graphs.

Functions

def find_all_paths
 Finds all paths between nodes, which already have edges drawn between them. More...
 
def get_graph_as_dict
 converts a list of graphNode objects (nodes), which have been initiated with scores and edges into a dictionary representation of a graph (graph). More...
 
def score_graph
 Function to score a graph based on nodes, which has scores and edges, as well as keys, which is a list of the states visited. More...
 

Function Documentation

def IMP.spatiotemporal.score_graph.find_all_paths (   graph,
  start,
  end,
  path = [] 
)

Finds all paths between nodes, which already have edges drawn between them.

Parameters
graphdictionary representation of the graph, acquired in get_graph_as_dict()
startgraphNode, candidate for starting the graph
endgraphNode, candidate to end the graph
pathlist of graphNodes on the path, which is defined recursively.
Returns
paths: list of all paths that exist between the starting node and ending node
Note
This function is only available in Python.

Definition at line 26 of file score_graph.py.

def IMP.spatiotemporal.score_graph.get_graph_as_dict (   nodes)

converts a list of graphNode objects (nodes), which have been initiated with scores and edges into a dictionary representation of a graph (graph).

Each node in the graph is a key, which returns edges in the next state.

Parameters
nodeslist of graphNode objects
Returns
graph: dictionary where each node is a key and the values are the edges in the graph for that node
Note
This function is only available in Python.

Definition at line 13 of file score_graph.py.

def IMP.spatiotemporal.score_graph.score_graph (   nodes,
  keys 
)

Function to score a graph based on nodes, which has scores and edges, as well as keys, which is a list of the states visited.

Note that all edges must be drawn and scores must be added to nodes before calling this function.

Parameters
nodeslist of graphNode objects, which has been initialized with all weights and edges
keyslist of all ordered states (strings) visited along the graph. Paths will be determined in sequential order passed to this function.
Returns
all_paths: list of all paths through the graph. Each path is a list of graphNode objects that correspond to the states visited along the path.
path_prob: list of probabilities for each path, ordered in the same order as all_paths
path_scores: list of tuples, where the first object is the path (list of graphNode objects for each state along the trajectory), and the second object is the score of the path, which can be used to calculate the probability.
Note
This function is only available in Python.

Definition at line 56 of file score_graph.py.