find_connecting_bonds#
- find_connecting_bonds(sites, **kwargs)[source]#
Finds the edge that connects each pair of given nodes
- Parameters:
inds (array_like) – A 2-column vector containing pairs of node indices
network (dict, optional) – The network dictionary. Either this or
am
must be providedam (scipy.sparse matrix, optional) – The adjacency matrix of the network. Must be symmetrical such that if nodes i and j are connected, the matrix contains non-zero values at locations (i, j) and (j, i). Either this or
g
must be provided.
- Returns:
edges – An ndarry the same length as P1 (and P2) with each element containing the edge number that connects the corresponding nodes, or nan` if nodes are not connected.
- Return type:
ndarray
Notes
The adjacency matrix is converted to the
DOK
format internally if needed, so if this format is already available it should be provided to save time.