besmarts.core.graphs module¶
besmarts.core.graphs
Definitions and basic functions of the three graph data types of the BESMARTS package. The graph class is the most basic, followed by the subgraph subclass. The structure class extends a subgraph by defining using a structure_topology, which describes the primary atoms in the subgraph. Much of the mapping and operations in the BESMARTS package only work on structures of the same topology, for example bonds, angles and dihedrals.
- class besmarts.core.graphs.graph(nodes: Dict[int, bechem], edges: Dict[Tuple[int, int], bechem])[source]¶
Bases:
objectA BESMARTS graph is a map of nodes and edges containing encoded primitives.
- cache: Dict¶
- besmarts.core.graphs.graph_all(g: graph) bool[source]¶
Return whether all primitives are full
- Parameters:
g (graph) – The input the graph
- Returns:
Whether all primitives are full
- Return type:
bool
- besmarts.core.graphs.graph_angles(g: graph) Sequence[Tuple[int, int, int]][source]¶
Return the IDs of the angles
- Parameters:
g (graph) – The input the graph
- Returns:
A sequence of 3-tuples containing the angle IDs
- Return type:
Sequence[Tuple[int, int, int]]
- besmarts.core.graphs.graph_any(g: graph) bool[source]¶
Return whether there is a value set in any primitive in the graph.
- Parameters:
g (graph) – The input the graph
- Returns:
Whether any primitive has a value
- Return type:
bool
- besmarts.core.graphs.graph_as_structure(g: graph, select: Sequence[int], topo: structure_topology) structure[source]¶
Make a structure from a given graph
- Parameters:
g (graph) – The input graph
select (Sequence[Sequence[node_id]]) – The selection for the structure
topo (structure_topology) – The topology of the structure
- Returns:
A sequence of structures, one for each input selection
- Return type:
- besmarts.core.graphs.graph_as_subgraph(g: graph, select: Sequence[int]) subgraph[source]¶
Make a subgraph from a given graph
- Parameters:
g (graph) – The input graph
selection (Sequence[node_id]) – The selection of the subgraph
- Return type:
- besmarts.core.graphs.graph_atoms(g: graph) Sequence[Tuple[int]][source]¶
Return the IDs of the atoms
- Parameters:
g (graph) – The input the graph
- Returns:
A sequence of 1-tuples containing the atom IDs
- Return type:
Sequence[Tuple[node_id]]
- besmarts.core.graphs.graph_bits(g: graph, maxbits=True) int[source]¶
Return the number of bits set across all primitives
- Parameters:
g (graph) – The input the graph
maxbits (bool) – Whether to use the maximum bit limits when counting full primitives
- Returns:
The number of bits set in the graph
- Return type:
int
- besmarts.core.graphs.graph_bits_max(g: graph) int[source]¶
Return the number of maximum bits set across all primitives
- Parameters:
g (graph) – The input the graph
maxbits (bool) – Whether to use the maximum bit limits when counting full primitives
- Returns:
The number of bits set in the graph
- Return type:
int
- besmarts.core.graphs.graph_bonds(g: graph) Sequence[Tuple[int, int]][source]¶
Return the IDs of the bonds
- Parameters:
g (graph) – The input the graph
- Returns:
A sequence of 2-tuples containing the bond IDs
- Return type:
Sequence[Tuple[int, int]]
- besmarts.core.graphs.graph_clear(beg: graph) graph[source]¶
Clear all selected primitives in a graph
- besmarts.core.graphs.graph_connection(g: graph, a: int)[source]¶
Return the nodes that are connected to a given node
- besmarts.core.graphs.graph_connections(g: graph)[source]¶
Return a list of connected nodes for all nodes
- besmarts.core.graphs.graph_detect_rings(g: graph, adj=None)[source]¶
Decompose and return the shortest paths, connections, and ring edges of a graph
- Parameters:
g (graph) – The input graph
adj (Dict[node_id, Sequence[node_id]]) – A node adjacency map
- Returns:
- pathsDict[node_id, Dict[node_id, Sequence[node_id]]]
The shortest paths between all nodes that avoid ring edges
- connectionsDict[node_id, Sequence[node_id]]
A node adjacency map that avoids ring edges
- ringsDict[edge_id, chem.bechem]
A mapping of edges and their primitives that form rings/cycles in the graph
- Return type:
tuple
- besmarts.core.graphs.graph_disable_primitives_atom(g: graph, select: Sequence[primitive_key]) None[source]¶
Disable the selected primitives for the atoms
- Parameters:
g (graph) – The input the graph
select (Sequence[primitive_key]) – The primitives to select in all atoms
- Return type:
None
- besmarts.core.graphs.graph_disable_primitives_bond(g: graph, select: Sequence[primitive_key]) None[source]¶
Disable the selected primitives for the atoms
- Parameters:
g (graph) – The input the graph
select (Sequence[primitive_key]) – The primitives to select in all atoms
- Return type:
None
- besmarts.core.graphs.graph_invert_all(beg: graph) None[source]¶
Invert primitives in a graph that are full
- besmarts.core.graphs.graph_invert_any(beg: graph) None[source]¶
Invert primitives in a graph that have any bit set
- besmarts.core.graphs.graph_is_null(g: graph) bool[source]¶
Return whether any node or edge is null, defined as whether any primitive is null
- Parameters:
g (graph) – The input the graph
- Returns:
Whether the graph is null
- Return type:
bool
- besmarts.core.graphs.graph_is_valid(g: graph) bool[source]¶
Return whether all nodes are not null, defined as whether every primitive has at least one value set. This indicates whether the graph can represent a valid SMILES or SMARTS string.
- Parameters:
g (graph) – The input the graph
- Returns:
Whether the graph is valid
- Return type:
bool
- besmarts.core.graphs.graph_minimum_spanning_tree(g: graph, adj=None, keep: Sequence[Tuple[int, int]] = None) graph[source]¶
Return a minimum spanning tree of a graph. This is an unweighted version, and not likely not even minimum in any sense. It primarily works to break rings.
- Parameters:
g (graph) – The input graph
adj (Dict[int, List[int]]) – An adjacency dictionary
keep (Sequence[edge_id]) – A list of edges that must be in the spanning tree
- Returns:
The minimum spanning tree of the graph
- Return type:
- besmarts.core.graphs.graph_outofplanes(g: graph) Sequence[Tuple[int, int, int, int]][source]¶
Return the IDs of the nonlinear out-of-plane dihedrals
- Parameters:
g (graph) – The input the graph
- Returns:
A sequence of 4-tuples containing the dihedral IDs
- Return type:
Sequence[Tuple[int, int, int, int]]
- besmarts.core.graphs.graph_pairs(g: graph) Sequence[Tuple[int, int]][source]¶
Return the IDs of the pairs
- Parameters:
g (graph) – The input the graph
- Returns:
A sequence of 2-tuples containing the pair IDs
- Return type:
Sequence[Tuple[int, int]]
- besmarts.core.graphs.graph_relabel_nodes(g: graph, M: Dict[int, int]) graph[source]¶
Return the nodes selected by the subgraph.
- Parameters:
g (subgraph) – The input subgraph
- Returns:
The selected nodes
- Return type:
Sequence[node_id]
- besmarts.core.graphs.graph_remove_hydrogen(g: graph) graph[source]¶
Remove the non-primary nodes that define hydrogen fragments. Only nodes that have only hydrogen defined in the element primitive are removed.
- Parameters:
g (graph) – The input graph
- Returns:
A new graph without hydrogen
- Return type:
- besmarts.core.graphs.graph_remove_nodes(g: graph, nodes: Sequence[int]) graph[source]¶
Remove a list of nodes from a structure
- Parameters:
g (structure) – The input structure
nodes (Sequence[node_id]) – The nodes to remove
- Returns:
A new structure with the nodes removed
- Return type:
- besmarts.core.graphs.graph_set_primitives_atom(g: graph, select: Sequence[primitive_key]) None[source]¶
Set the selected primitives for the atoms
- Parameters:
g (graph) – The input the graph
select (Sequence[primitive_key]) – The primitives to select in all atoms
- Return type:
None
- besmarts.core.graphs.graph_set_primitives_bond(beg, select)[source]¶
Set the selected primitives for the bonds
- Parameters:
g (graph) – The input the graph
select (Sequence[primitive_key]) – The primitives to select in all bonds
- Return type:
None
- besmarts.core.graphs.graph_shortest_path(g: graph, a: int, b: int, adj=None) Sequence[int][source]¶
Return the shortest path between two nodes
- Parameters:
g (graph) – The input graph
a (node_id) – The source node
b (node_id) – The destination node
adj (Dict[node_id, Sequence[node_id]]) – A node adjacency map
- Returns:
The shortest path of nodes between the source and destination. The path includes the source and destination.
- Return type:
Sequence[node_id]
- besmarts.core.graphs.graph_shortest_path_length(g: graph, a: int, b: int, adj=None) int[source]¶
Return the length of the shortest path between two nodes
- Parameters:
g (graph) – The input graph
src (node_id) – The source node
dst (node_id) – The destination node
adj (Dict[node_id, Sequence[node_id]) – A node adjacency map
- Returns:
The path length
- Return type:
int
- besmarts.core.graphs.graph_shortest_paths(g: graph, adj=None)[source]¶
Return the shortest paths for each pair of nodes in a graph
- Parameters:
g (graph) – The input graph
adj (Dict[int, Seqence[node_id]]) – A node adjacency map
- Returns:
A 2D mapping of source and destination nodes to a list of nodes defining the shortest path. The source and destination nodes are included in the path. For example, paths[a][b] is a list of nodes describing the shortest path between nodes a and b.
- Return type:
Dict[node_id, Dict[node_id, Sequence[node_id]]]
- besmarts.core.graphs.graph_to_structure(g: graph, select: Sequence[int], topo: structure_topology) structure[source]¶
Make a structure from a given graph
- Parameters:
g (graph) – The input graph
select (Sequence[Sequence[node_id]]) – The selection for the structure
topo (structure_topology) – The topology of the structure
- Returns:
A sequence of structures, one for each input selection
- Return type:
- besmarts.core.graphs.graph_to_structure_angles(g: graph)[source]¶
Make a structure representing each angle in a graph
- Parameters:
g (graph) – The input graph
- Returns:
A sequence of angle structures
- Return type:
Sequence[structure]
- besmarts.core.graphs.graph_to_structure_atoms(beg: graph) Sequence[structure][source]¶
Make a structure representing each atom in a graph
- Parameters:
g (graph) – The input graph
- Returns:
A sequence of atom structures
- Return type:
Sequence[structure]
- besmarts.core.graphs.graph_to_structure_bonds(beg: graph) Sequence[structure][source]¶
Make a structure representing each bond in a graph
- Parameters:
g (graph) – The input graph
- Returns:
A sequence of bond structures
- Return type:
Sequence[structure]
- besmarts.core.graphs.graph_to_structure_outofplanes(g: graph) Sequence[structure][source]¶
Make a structure representing each out-of-plane dihedral in a graph
- Parameters:
g (graph) – The input graph
- Returns:
A sequence of out-of-plane dihedral structures
- Return type:
Sequence[structure]
- besmarts.core.graphs.graph_to_structure_pairs(beg: graph) Sequence[structure][source]¶
Make a structure representing each bond in a graph
- Parameters:
g (graph) – The input graph
- Returns:
A sequence of bond structures
- Return type:
Sequence[structure]
- besmarts.core.graphs.graph_to_structure_torsions(g: graph) Sequence[structure][source]¶
Make a structure representing each torsion dihedral in a graph
- Parameters:
g (graph) – The input graph
- Returns:
A sequence of torsion dihedral structures
- Return type:
Sequence[structure]
- besmarts.core.graphs.graph_to_structures(g: graph, selections: Sequence[Sequence[int]], topo: structure_topology) Sequence[structure][source]¶
Make a structure from a given graph
- Parameters:
g (graph) – The input graph
selections (Sequence[Sequence[node_id]]) – A list of selections for each structure
topo (structure_topology) – The topology of the structure
- Returns:
A sequence of structures, one for each input selection
- Return type:
Sequence[structure]
- besmarts.core.graphs.graph_to_subgraph(g: graph, select: Sequence[int]) subgraph[source]¶
Make a subgraph from a given graph
- Parameters:
g (graph) – The input graph
selection (Sequence[node_id]) – The selection of the subgraph
- Return type:
- besmarts.core.graphs.graph_to_subgraphs(g: graph, selections: Sequence[Sequence[int]]) Sequence[subgraph][source]¶
Make subgraphs from a given graph
- Parameters:
g (graph) – The input graph
selections (Sequence[Sequence[node_id]]) – A list of selections for each subgraph
- Returns:
A sequence of subgraph, one for each input selection
- Return type:
Sequence[subgraph]
- besmarts.core.graphs.graph_topology(g, topo)[source]¶
Return the IDs of the primary atoms defined by the topology
- Parameters:
g (graph) – The input the graph
- Returns:
A sequence of 4-tuples containing the dihedral IDs
- Return type:
Sequence[Tuple[int, int, int, int]]
- besmarts.core.graphs.graph_torsions(g: graph) Sequence[Tuple[int, int, int, int]][source]¶
Return the IDs of the torsion dihedrals
- Parameters:
g (graph) – The input the graph
- Returns:
A sequence of 4-tuples containing the torsion dihedral IDs
- Return type:
Sequence[Tuple[int, int, int, int]]
- class besmarts.core.graphs.structure(nodes: Dict[int, bechem], edges: Dict[Tuple[int, int], bechem], select: Sequence[int], topology: structure_topology)[source]¶
Bases:
subgraphA BESMARTS structure is a subgraph that additionally describes a core structure in the subgraph. The core structure is defined by a topology, which identifies which of the selected nodes form the core structure. Examples of structures are bonds, angles, and torsions. These are always defined to have the same topology. The depth of a structure is defined by the distance from any of the atoms in the core structure, called the primary nodes in the topology.
- cache: Dict¶
- hashes: Dict¶
- select: Sequence[int]¶
- topology: structure_topology¶
- besmarts.core.graphs.structure_angle(g: graph, select: Sequence[int]) structure[source]¶
Build a structure of an angle from a graph
- Parameters:
g (graph) – The input graph
select (Sequence[int]) – The selection defining the subgraph
Returns
structure – A structure defining an angle
- besmarts.core.graphs.structure_atom(g: graph, select: Sequence[int]) structure[source]¶
Build a structure of an atom from a graph
- Parameters:
g (graph) – The input graph
select (Sequence[int]) – The selection defining the subgraph
Returns
structure – A structure defining an atom
- besmarts.core.graphs.structure_bits(g: structure) int[source]¶
Return the number of bits set across all selected primitives of the subgraph
- Parameters:
g (structure) – The input the graph
maxbits (bool) – Whether to use the maximum bit limits when counting full primitives
- Returns:
The number of bits set in the subgraph
- Return type:
int
- besmarts.core.graphs.structure_bond(g: graph, select: Sequence[int]) structure[source]¶
Build a structure of a bond from a graph
- Parameters:
g (graph) – The input graph
select (Sequence[int]) – The selection defining the subgraph
Returns
structure – A structure defining a bond
- besmarts.core.graphs.structure_branch(template, m: dict, n, d, visited_groups=None, verbose=True) Generator[source]¶
- besmarts.core.graphs.structure_build(g: graph, select: Sequence[int], topo: structure_topology) structure[source]¶
Build a structure from a graph
- Parameters:
g (graph) – The input graph
select (Sequence[int]) – The selection defining the subgraph
topology (structure_topology) – The topology defining the structure
Returns
structure – A structure defining some given topology
- besmarts.core.graphs.structure_extend(config: smarts_extender_config, atoms: Sequence[structure]) bool[source]¶
Extend the selection of each structure to the specified depth. This potentially modifies the selection in each structure.
- Parameters:
config (smarts_extender_config) – The configuration for extending the structures
atoms (List[graphs.structure]) – The structures to extend.
- Returns:
Whether any of the structure selections were modified.
- Return type:
bool
- besmarts.core.graphs.structure_frontier_nodes(g, nodes, adj=None) Dict[int, Sequence[int]][source]¶
Return the nodes that are one level deeper than the given input nodes of the structure.
- Parameters:
g (structure) – The input structure
nodes (Sequence[node_id]) – The input nodes to get the frontier nodes of
adj (Dict[node_id, Sequence[node_id]]) – An adjacency map of the nodes
- Returns:
A mapping of nodes and their corresponding frontier nodes.
- Return type:
Dict[node_id, Sequence[node_id]]
- besmarts.core.graphs.structure_hash(g: structure) int[source]¶
Return the hash of a structure
- Returns:
The hash
- Return type:
int
- besmarts.core.graphs.structure_invert(beg: structure) None[source]¶
Invert selected primitives in a graph
- besmarts.core.graphs.structure_invert_any(beg: structure) None[source]¶
Invert selected primitives in a graph
- besmarts.core.graphs.structure_node_depth(g: structure, node: int, depth_cache=None, adj=None)[source]¶
get the vertices at some some depth from the primary set
- besmarts.core.graphs.structure_node_depths(g: structure) Sequence[int][source]¶
Return the depths of all selected nodes in a structure, defined as the distance away from the primary nodes of the structure’s topology.
- Parameters:
g (structure) – The input structure
- Returns:
A mapping of nodes their depths
- Return type:
Dict[node_id, int]
- besmarts.core.graphs.structure_outofplane(g: graph, select: Sequence[int]) structure[source]¶
Build a structure of an out-of-plane dihedral from a graph
- Parameters:
g (graph) – The input graph
select (Sequence[int]) – The selection defining the subgraph
Returns
structure – A structure defining an out-of-plane dihedral
- besmarts.core.graphs.structure_prune_null_nodes(g: structure) structure[source]¶
Remove nodes that have any null primitives
- Parameters:
g (structure) – The input structure
- Returns:
A new structure with the nodes removed, or None if the result is not a valid structure
- Return type:
- besmarts.core.graphs.structure_relabel_nodes(g: structure, M: Dict[int, int]) structure[source]¶
Return a structure copy with relabled nodes
- Parameters:
g (structure) – The input structure
M (Dict[node_id, node_id]) – A mapping of nodes and their new ID
- Returns:
The relabeled structure
- Return type:
- besmarts.core.graphs.structure_remove_hydrogen(g: structure) structure[source]¶
Remove the non-primary nodes that define hydrogen fragments. Only nodes that have only hydrogen defined in the element primitive are removed.
- Parameters:
g (structure) – The input structure
- Returns:
A new structure without hydrogen
- Return type:
- besmarts.core.graphs.structure_remove_nodes(g: structure, nodes: Sequence[int]) structure[source]¶
Remove a list of nodes from a structure
- Parameters:
g (structure) – The input structure
nodes (Sequence[node_id]) – The nodes to remove
- Returns:
A new structure with the nodes removed
- Return type:
- besmarts.core.graphs.structure_remove_unselected(g: structure) structure[source]¶
Return a structure that has all unselected nodes removed from the graph.
- Parameters:
g (structure) – The input structure
- Returns:
A new structure with no unselected nodes
- Return type:
- besmarts.core.graphs.structure_to_graph(g: structure) graph[source]¶
Make a graph from a structure’s subgraph that only includes the subgraph
- Parameters:
g (structure) – The input structure
- Returns:
A graph only containing the subgraph
- Return type:
- besmarts.core.graphs.structure_to_intvec(g: structure, atom_primitives, bond_primitives) intvec[source]¶
- besmarts.core.graphs.structure_to_subgraph(g: structure) subgraph[source]¶
Make a graph from a structure’s subgraph that only includes the subgraph
- Parameters:
g (structure) – The input structure
- Returns:
A graph only containing the subgraph
- Return type:
- besmarts.core.graphs.structure_torsion(g: graph, select: Sequence[int]) structure[source]¶
Build a structure of a torsion dihedral from a graph
- Parameters:
g (graph) – The input graph
select (Sequence[int]) – The selection defining the subgraph
Returns
structure – A structure defining a torsion dihedral
- besmarts.core.graphs.structure_unreachable_nodes(g: structure) Sequence[int][source]¶
Return the nodes that are not reachable from the primary nodes of the topology
- Parameters:
g (structure) – The input structure
- Returns:
The unreachable nodes
- Return type:
Sequence[node_id]
- besmarts.core.graphs.structure_vertices_at_depth(g: structure, depth: int, depth_cache=None, adj=None)[source]¶
Return the nodes at some some depth from the primary nodes
- Parameters:
g (structure) – The input structure
depth (int) – The depth of the returned nodes
depth_cache (Dict[node_id, int]) – A cache of precalculated depths
adj (Dict[node_id, Sequence[node_id]]) – An adjacency map
- Returns:
The nodes at the given depth
- Return type:
Sequence[node_id]
- class besmarts.core.graphs.subgraph(nodes: Dict[int, bechem], edges: Dict[Tuple[int, int], bechem], select: Sequence[int])[source]¶
Bases:
graphA BESMARTS subgraph is a node-induced subgraph, where the subgraph is defined by the select nodes.
- cache: Dict¶
- select: Sequence[int]¶
- besmarts.core.graphs.subgraph_any(g: subgraph) bool[source]¶
Return whether there is a value set in any primitive in the subgraph.
- Parameters:
g (graph) – The input the subgraph
- Returns:
Whether any primitive has a value
- Return type:
bool
- besmarts.core.graphs.subgraph_as_graph(g: subgraph) structure[source]¶
Return a structure from downcasting a subgraph.
- Parameters:
subg (subgraph) – The input subgraph
topology (topology.structure_topology) – The topology of the structure
- Returns:
The structure. The graph is not copied and references the input
- Return type:
- besmarts.core.graphs.subgraph_as_structure(g: subgraph, topo: structure_topology) structure[source]¶
Return a structure from downcasting a subgraph.
- Parameters:
subg (subgraph) – The input subgraph
topology (topology.structure_topology) – The topology of the structure
- Returns:
The structure. The graph is not copied and references the input
- Return type:
- besmarts.core.graphs.subgraph_bits(g: subgraph) int[source]¶
Return the number of bits set across all selected primitives of the subgraph
- Parameters:
subg (subgraph) – The input the graph
maxbits (bool) – Whether to use the maximum bit limits when counting full primitives
- Returns:
The number of bits set in the subgraph
- Return type:
int
- besmarts.core.graphs.subgraph_connection(g: subgraph, a: int) Sequence[int][source]¶
Return the selected nodes that are connected to a given node
- besmarts.core.graphs.subgraph_connections(g: subgraph) Sequence[int][source]¶
Return the selected nodes that are connected to a given node
- besmarts.core.graphs.subgraph_copy(g: subgraph) subgraph[source]¶
Return a copy
- Parameters:
subg (subgraph) – The input subgraph
- Returns:
A copy of the subgraph
- Return type:
- besmarts.core.graphs.subgraph_edges(sg: subgraph) Sequence[Tuple[int, int]][source]¶
Return the edges of the node-induced subgraph
- Parameters:
subg (subgraph) – The input subgraph
- Returns:
The sequence of edges of the subgraph
- Return type:
Sequence[edge_id]
- besmarts.core.graphs.subgraph_fill(g: subgraph) None[source]¶
Fill the primitives in the subgraph.
- Parameters:
subg (subgraph) – The input subgraph
- Return type:
None
- besmarts.core.graphs.subgraph_hash(g: subgraph) int[source]¶
Return the hash of a subgraph.
- Returns:
The hash
- Return type:
int
- besmarts.core.graphs.subgraph_invert(beg: subgraph) None[source]¶
Invert selected primitives in a graph
- besmarts.core.graphs.subgraph_nodes(g: subgraph) Sequence[int][source]¶
Return the nodes selected by the subgraph.
- Parameters:
g (subgraph) – The input subgraph
- Returns:
The selected nodes
- Return type:
Sequence[node_id]
- besmarts.core.graphs.subgraph_relabel_nodes(g: subgraph, M: Dict[int, int]) subgraph[source]¶
Return the nodes selected by the subgraph.
- Parameters:
g (subgraph) – The input subgraph
- Returns:
The selected nodes
- Return type:
Sequence[node_id]
- besmarts.core.graphs.subgraph_remove_unselected(g: structure) structure[source]¶
Return a subgraph that has all unselected nodes removed from the graph.
- Parameters:
g (subgraph) – The input structure
- Returns:
A new subgraph with no unselected nodes
- Return type:
- besmarts.core.graphs.subgraph_to_graph(g: subgraph) graph[source]¶
Make a graph from a subgraph that only includes the subgraph
- Parameters:
subg (subgraph) – The input subgraph
- Returns:
A graph only containing the subgraph
- Return type:
- besmarts.core.graphs.subgraph_to_intvec(g: subgraph, atom_primitives, bond_primitives) intvec[source]¶
- besmarts.core.graphs.subgraph_to_structure(g: subgraph, topo: structure_topology) structure[source]¶
Return a structure from a copy of the subgraph
- Parameters:
g (subgraph) – The input subgraph
topo (topology.structure_topology) – The topology of the structure
- Returns:
The structure
- Return type:
- besmarts.core.graphs.subgraph_validate_structure(g: subgraph, topo: structure_topology) bool[source]¶
Return a structure
- Parameters:
subg (subgraph) – The input subgraph
topology (topology.structure_topology) – The topology of the structure
- Returns:
Whether the subgraph can be represented as a structure with the given topology
- Return type:
bool