spyrmsd.graphs.nx module
- spyrmsd.graphs.nx.cycle(n)[source]
Build cycle graph
- Parameters
n (int) – Number of nodes
- Returns
Cycle graph
- Return type
Graph
- spyrmsd.graphs.nx.graph_from_adjacency_matrix(adjacency_matrix: Union[ndarray, List[List[int]]], aprops: Optional[Union[ndarray, List[Any]]] = None) Graph [source]
Graph from adjacency matrix.
- Parameters
adjacency_matrix (Union[np.ndarray, List[List[int]]]) – Adjacency matrix
aprops (Union[np.ndarray, List[Any]], optional) – Atomic properties
- Returns
Molecular graph
- Return type
Graph
Notes
It the atomic numbers are passed, they are used as node attributes.
- spyrmsd.graphs.nx.lattice(n1, n2)[source]
Build 2D lattice graph
- Parameters
n1 (int) – Number of nodes in dimension 1
n2 (int) – Number of nodes in dimension 2
- Returns
Lattice graph
- Return type
Graph
- spyrmsd.graphs.nx.match_graphs(G1, G2) List[Tuple[List[int], List[int]]] [source]
Compute graph isomorphisms.
- Parameters
G1 – Graph 1
G2 – Graph 2
- Returns
All possible mappings between nodes of graph 1 and graph 2 (isomorphisms)
- Return type
List[Tuple[List[int],List[int]]]
- Raises
NonIsomorphicGraphs – If the graphs G1 and G2 are not isomorphic
- spyrmsd.graphs.nx.num_edges(G) int [source]
Number of edges
- Parameters
G – Graph
- Returns
Number of edges
- Return type
int