pairs_to_graph#

er_evaluation.data_structures.pairs_to_graph(pairs, indices)[source]#

Transform pairs list into Graph.

Parameters:
  • pairs (ndarray) – array of paired elements.

  • indices (ndarray) – flat array of all elements to consider (paired and non-paired), including singletons.

Returns:

Graph corresponding to the pairs list with given indices as vertices. Note that all elements are converted to string before creating the graph.

Note

All elements are converted to string before creating the graph.

Examples

>>> from numpy import array
>>> pairs = array([[1, 2], [3, 5], [6, 7], [6, 8], [7, 8]])
>>> indices = array([1,2,3,4,5,6,7,8])
>>> graph = pairs_to_graph(pairs, indices)