Graph#

Graph representations, canonicalization, ITS utilities, matching engines, MTG tools, and wildcard-aware graph workflows.

Core#

class synkit.Graph.syn_graph.SynGraph(graph: Graph, canonicaliser: GraphCanonicaliser | None = None, canon: bool = True)[source]#

Bases: object

property canonical: Graph | None#
get_edges(data: bool = True) Iterable[Tuple[Any, Any] | Tuple[Any, Any, Dict[str, Any]]][source]#
get_nodes(data: bool = True) Iterable[Any | Tuple[Any, Dict[str, Any]]][source]#
help() None[source]#
property raw: Graph#
property signature: str | None#
class synkit.Graph.canon_graph.CanonicalGraph(g: Graph, canon: GraphCanonicaliser)[source]#

Bases: object

property canonical_graph: Graph#
property canonical_hash: str#
help() None[source]#
property original_graph: Graph#
class synkit.Graph.canon_graph.CanonicalRule(rule: str, canon: GraphCanonicaliser = <GraphCanonicaliser backend='generic' node_key=_default_node_key edge_key=_default_edge_key>)[source]#

Bases: object

property canonical_graph: Graph#
property canonical_hash: str#
property canonical_rule: str#
help() None[source]#
property original_graph: Graph#
property original_rule: str#
class synkit.Graph.canon_graph.GraphCanonicaliser(*, backend: ~typing.Literal['generic', 'wl', 'morgan', 'nauty'] = 'generic', wl_iterations: int = 3, morgan_radius: int = 3, node_attrs: ~typing.List[str] = ['element', 'aromatic', 'charge', 'lone_pairs', 'radical', 'hcount'], node_sort_key: ~typing.Callable[[~typing.Hashable, ~typing.Dict[str, ~typing.Any]], ~typing.Tuple[~typing.Any, ...]] = <function _default_node_key>, edge_sort_key: ~typing.Callable[[~typing.Hashable, ~typing.Hashable, ~typing.Dict[str, ~typing.Any]], ~typing.Tuple[~typing.Any, ...]] = <function _default_edge_key>)[source]#

Bases: object

canonical_signature(graph: Graph) str[source]#
canonicalise_graph(graph: Graph) CanonicalGraph[source]#
canonicalise_graphs(graphs: Iterable[Graph]) Tuple[CanonicalGraph, ...][source]#
graph_canonical_hash(graph: Graph) str#
help() None[source]#
make_canonical_graph(g: Graph) Graph#
synkit.Graph.utils.add_wildcard_subgraph_for_unmapped(G: Graph, L: Graph, mapping: Dict[Any, Any], edge_keys: List[str] = ['order'], inplace: bool = False, tuple_mode: bool = False) Tuple[Graph, Dict[Any, Any]][source]#
synkit.Graph.utils.clean_graph_keep_largest_component(graph: Graph) Graph[source]#
synkit.Graph.utils.has_wildcard_node(G: Graph, element_attr: str = 'element', wildcard: Any = '*') bool[source]#
synkit.Graph.utils.print_graph_attributes(G: Graph) None[source]#
synkit.Graph.utils.remove_wildcard_nodes(G: Graph, inplace: bool = True) Graph[source]#

Canonicalization#

synkit.Graph.Canon.canon_algs.canon_morgan(g: Graph, morgan_radius: int = 2, node_attributes: List[str] = None) Tuple[Graph, str][source]#
synkit.Graph.Canon.canon_algs.eigen_canonical_signature(g: Graph) str[source]#
synkit.Graph.Canon.canon_algs.pgraph_signature(g: Graph, p: int = 4) str[source]#
synkit.Graph.Canon.canon_algs.ring_canonical_graph(g: Graph) Tuple[Graph, str][source]#
class synkit.Graph.Canon.canon_graph.CanonicalGraph(g: Graph, canon: GraphCanonicaliser)[source]#

Bases: object

property canonical_graph: Graph#
property canonical_hash: str#
help() None[source]#
property original_graph: Graph#
class synkit.Graph.Canon.canon_graph.CanonicalRule(rule: str, canon: GraphCanonicaliser = <GraphCanonicaliser backend='generic' node_key=_default_node_key edge_key=_default_edge_key>)[source]#

Bases: object

property canonical_graph: Graph#
property canonical_hash: str#
property canonical_rule: str#
help() None[source]#
property original_graph: Graph#
property original_rule: str#
class synkit.Graph.Canon.canon_graph.GraphCanonicaliser(*, backend: ~typing.Literal['generic', 'wl', 'morgan', 'nauty'] = 'generic', wl_iterations: int = 3, morgan_radius: int = 3, node_attrs: ~typing.List[str] = ['element', 'aromatic', 'charge', 'hcount'], node_sort_key: ~typing.Callable[[~typing.Hashable, ~typing.Dict[str, ~typing.Any]], ~typing.Tuple[~typing.Any, ...]] = <function _default_node_key>, edge_sort_key: ~typing.Callable[[~typing.Hashable, ~typing.Hashable, ~typing.Dict[str, ~typing.Any]], ~typing.Tuple[~typing.Any, ...]] = <function _default_edge_key>)[source]#

Bases: object

canonical_signature(graph: Graph) str[source]#
canonicalise_graph(graph: Graph) CanonicalGraph[source]#
canonicalise_graphs(graphs: Iterable[Graph]) Tuple[CanonicalGraph, ...][source]#
graph_canonical_hash(graph: Graph) str#
help() None[source]#
make_canonical_graph(g: Graph) Graph#
class synkit.Graph.Canon.nauty.NautyCanonicalizer(node_attrs: list[str] | None = None, edge_attrs: list[str] | None = None)[source]#

Bases: object

canonical_form(G: Graph, return_aut: bool = False, remap_aut: bool = False, return_orbits: bool = False, return_perm: bool = False, max_depth: int | None = None)[source]#
compute_orbits(aut_perms)[source]#
edge_attrs#
graph_signature(G)[source]#
node_attrs#

Context#

class synkit.Graph.Context.hier_context.HierContext(node_label_names: List[str] = ['element', 'charge'], node_label_default: List[Any] = ['*', 0], edge_attribute: str = 'order', max_radius: int = 3)[source]#

Bases: RadiusExpand

fit(original_data: List[Dict[str, Any]], its_key: str = 'ITS', context_key: str = 'K') Tuple[List[Dict[str, Any]], List[List[Dict[str, Any]]]][source]#
class synkit.Graph.Context.radius_expand.RadiusExpand[source]#

Bases: object

static context_extraction(data: Dict[str, Any], its_key: str = 'ITS', context_key: str = 'K', n_knn: int = 0) Dict[str, Any][source]#
static extract_k(its: Graph, n_knn: int = 0) Tuple[Graph, Any][source]#
static extract_subgraph(G: Graph, node_indices: List[int]) Graph[source]#
static find_nearest_neighbors(G: Graph, center_nodes: List[int], n_knn: int = 1) Set[int][source]#
static find_unequal_order_edges(G: Graph) List[int][source]#
static longest_radius_extension(G: Graph, rc_nodes: List[int]) List[int][source]#
classmethod paralle_context_extraction(data: List[Dict[str, Any]], its_key: str = 'ITS', context_key: str = 'K', n_jobs: int = 1, verbose: int = 0, n_knn: int = 0) List[Dict[str, Any]][source]#
static remove_normal_edges(graph: Graph, property_key: str) Graph[source]#

Features#

class synkit.Graph.Feature.graph_descriptors.GraphDescriptor[source]#

Bases: object

static check_graph_type(G: Graph) str[source]#
static get_cycle_member_rings(G: Graph, type='minimal') List[int][source]#
static get_descriptors(entry: Dict, reaction_centers: str = 'RC', its: str = 'ITS', condensed: bool = True) Dict[source]#
static get_element_count(graph: Graph) Dict[str, int][source]#
static is_acyclic_graph(G: Graph) bool[source]#
static is_complex_cyclic_graph(G: Graph) bool[source]#
static is_graph_empty(graph: Graph | dict | list | Any) bool[source]#
static is_single_cyclic_graph(G: Graph) bool[source]#
static process_entries_in_parallel(entries: List[Dict], reaction_centers: str = 'RC', its: str = 'ITS', condensed: bool = True, n_jobs: int = 4, verbose: int = 0) List[Dict][source]#
synkit.Graph.Feature.graph_descriptors.check_graph_connectivity(graph: Graph) str[source]#
class synkit.Graph.Feature.graph_fps.GraphFP(graph: Graph, nBits: int = 1024, hash_alg: str = 'sha256')[source]#

Bases: object

fingerprint(method: str) str[source]#
iterative_deepening(remaining_bits: int) str[source]#
class synkit.Graph.Feature.graph_signature.GraphSignature(graph: Graph)[source]#

Bases: object

create_edge_signature(include_neighbors: bool = False, max_hop: int = 2) str[source]#
create_graph_signature(include_wl_hash: bool = True, include_neighbors: bool = True, max_hop: int = 1) str[source]#
create_wl_hash(iterations: int = 3) str[source]#
class synkit.Graph.Feature.hash_fps.HashFPs(graph: Graph, numBits: int = 256, hash_alg: str = 'sha256')[source]#

Bases: object

extract_features(start_node: int | None, end_node: int | None, max_path_length: int | None) str[source]#
finalize_hash(hash_object: Any, features: str) str[source]#
hash_fps(start_node: int | None = None, end_node: int | None = None, max_path_length: int | None = None) str[source]#
initialize_hash() Any[source]#
iterative_deepening(hash_object: Any, remaining_bits: int) str[source]#
validate_parameters() None[source]#
class synkit.Graph.Feature.morgan_fps.MorganFPs(graph: Graph, radius: int = 3, nBits: int = 1024, hash_alg: str = 'sha256')[source]#

Bases: object

generate_fingerprint() str[source]#
iterative_deepening(hash_object: Any, remaining_bits: int) str[source]#
class synkit.Graph.Feature.path_fps.PathFPs(graph: Graph, max_length: int = 10, nBits: int = 1024, hash_alg: str = 'sha256')[source]#

Bases: object

generate_fingerprint() str[source]#
iterative_deepening(hash_object: Any, remaining_bits: int) str[source]#
class synkit.Graph.Feature.wl_hash.WLHash(node: str | List[str] = ['element', 'charge'], edge: str | List[str] = 'order', iterations: int = 5, digest_size: int = 16)[source]#

Bases: object

process_data(data: List[Dict[str, str | Graph]], graph_key: str = 'ITS', subgraph: bool = False) List[Dict[str, str | None]][source]#
weisfeiler_lehman_graph_hash(graph: Graph) str[source]#
weisfeiler_lehman_subgraph_hashes(graph: Graph) Dict[int | str, List[str]][source]#

Functional groups#

synkit.Graph.FG.api.smiles_to_graph_and_functional_groups(smiles: str, *, sanitize: bool = True) tuple[Graph, list[tuple[str, tuple[int, ...]]]][source]#
class synkit.Graph.FG.audit.FunctionalGroupAudit(reactions: int, molecules: int, parse_failures: int, elapsed_seconds: float, label_counts: Counter[str], heteroaromatic_systems: int, named_heteroaromatic_systems: int, unnamed_heteroaromatic_systems: Counter[tuple], uncovered_atom_signatures: Counter[tuple], uncovered_edge_signatures: Counter[tuple])[source]#

Bases: object

elapsed_seconds: float#
heteroaromatic_systems: int#
label_counts: Counter[str]#
molecules: int#
named_heteroaromatic_systems: int#
parse_failures: int#
reactions: int#
uncovered_atom_signatures: Counter[tuple]#
uncovered_edge_signatures: Counter[tuple]#
property unnamed_heteroaromatic_count: int#
unnamed_heteroaromatic_systems: Counter[tuple]#
synkit.Graph.FG.audit.audit_reaction_smiles(reactions: Iterable[str], *, standardizer: Standardize | None = None) FunctionalGroupAudit[source]#
synkit.Graph.FG.catalog.default_registry() FunctionalGroupRegistry[source]#
class synkit.Graph.FG.detector.FunctionalGroupDetector(registry: FunctionalGroupRegistry | None = None)[source]#

Bases: object

detect(graph: Graph) list[tuple[str, tuple[int, ...]]][source]#
matches(graph: Graph) list[FunctionalGroupMatch][source]#
raw_matches(graph: Graph, *, include_internal: bool = False) list[FunctionalGroupMatch][source]#
class synkit.Graph.FG.model.FunctionalGroupMatch(name: str, group_nodes: tuple[int, ...], mapping: dict[int, int], pattern: FunctionalGroupPattern)[source]#

Bases: object

group_nodes: tuple[int, ...]#
mapping: dict[int, int]#
name: str#
pattern: FunctionalGroupPattern#
class synkit.Graph.FG.model.FunctionalGroupPattern(name: str, graph: Graph, group_nodes: tuple[int, ...], parents: tuple[str, ...] = (), suppresses: tuple[str, ...] = (), requires: tuple[str, ...] = (), anchor_node: int | None = None, priority: int = 0, validator: Callable[[Graph, dict[int, int]], bool] | None = None, recognizer: Callable[[Graph, FunctionalGroupPattern], list[FunctionalGroupMatch]] | None = None, public: bool = True)[source]#

Bases: object

anchor_node: int | None = None#
graph: Graph#
group_nodes: tuple[int, ...]#
name: str#
parents: tuple[str, ...] = ()#
priority: int = 0#
public: bool = True#
recognizer: Callable[[Graph, FunctionalGroupPattern], list[FunctionalGroupMatch]] | None = None#
requires: tuple[str, ...] = ()#
suppresses: tuple[str, ...] = ()#
validator: Callable[[Graph, dict[int, int]], bool] | None = None#
class synkit.Graph.FG.model.FunctionalGroupRegistry(patterns: list[FunctionalGroupPattern] = <factory>)[source]#

Bases: object

add(pattern: FunctionalGroupPattern) None[source]#
by_name(name: str) FunctionalGroupPattern[source]#
execution_order() list[FunctionalGroupPattern][source]#
extend(patterns: Iterable[FunctionalGroupPattern]) None[source]#
is_ancestor(ancestor: str, child: str) bool[source]#
patterns: list[FunctionalGroupPattern]#
class synkit.Graph.FG.ring_system.AromaticRingSystem(nodes: tuple[int, ...], edges: tuple[tuple[int, int], ...], hetero_nodes: tuple[int, ...], element_counts: dict[str, int], ring_sizes: tuple[int, ...], subrings: tuple[AromaticSubring, ...], is_fused: bool, hetero_sequence: tuple[str, ...] | None, hetero_pattern: str)[source]#

Bases: object

edges: tuple[tuple[int, int], ...]#
element_counts: dict[str, int]#
hetero_nodes: tuple[int, ...]#
hetero_pattern: str#
hetero_sequence: tuple[str, ...] | None#
is_fused: bool#
nodes: tuple[int, ...]#
ring_sizes: tuple[int, ...]#
subrings: tuple[AromaticSubring, ...]#
class synkit.Graph.FG.ring_system.AromaticRingSystemDetector[source]#

Bases: object

static detect(graph: Graph) list[AromaticRingSystem][source]#
class synkit.Graph.FG.ring_system.AromaticSubring(nodes: tuple[int, ...], element_counts: dict[str, int], hetero_sequence: tuple[str, ...])[source]#

Bases: object

element_counts: dict[str, int]#
hetero_sequence: tuple[str, ...]#
nodes: tuple[int, ...]#

Hydrogen utilities#

synkit.Graph.Hyrogen._misc.check_equivariant_graph(its_graphs: List[Graph]) Tuple[List[Tuple[int, int]], int][source]#
synkit.Graph.Hyrogen._misc.check_explicit_hydrogen(graph: Graph) tuple[source]#
synkit.Graph.Hyrogen._misc.check_hcount_change(react_graph: Graph, prod_graph: Graph) int[source]#
synkit.Graph.Hyrogen._misc.get_cycle_member_rings(G: Graph, type='minimal') List[int][source]#
synkit.Graph.Hyrogen._misc.get_priority(reaction_centers: List[Any]) List[int][source]#
synkit.Graph.Hyrogen._misc.h_to_explicit(G: Graph, nodes: List[int] = None, its: bool = False) Graph[source]#
synkit.Graph.Hyrogen._misc.h_to_implicit(G: Graph) Graph[source]#
synkit.Graph.Hyrogen._misc.has_HH(G: Graph) bool[source]#
synkit.Graph.Hyrogen._misc.has_XH(G: Graph) bool[source]#
synkit.Graph.Hyrogen._misc.implicit_hydrogen(graph: Graph, preserve_atom_maps: Set[int], reindex: bool = False) Graph[source]#
synkit.Graph.Hyrogen._misc.normalize_edge_orders(G: Graph) None[source]#
synkit.Graph.Hyrogen._misc.normalize_h_pair_graph(rc_graph: Graph, inplace: bool = False) Graph[source]#
synkit.Graph.Hyrogen._misc.standardize_hydrogen(G: Graph, in_place: bool = False) Graph[source]#
class synkit.Graph.Hyrogen.hcomplete.HComplete[source]#

Bases: object

TUPLE_EDGE_ATTRS = ['order', 'kekule_order', 'sigma_order', 'pi_order']#
TUPLE_NODE_ATTRS = ['element', 'aromatic', 'hcount', 'charge', 'atom_map', 'lone_pairs', 'radical', 'valence_electrons']#
static add_hydrogen_nodes_multiple(react_graph: Graph, prod_graph: Graph, ignore_aromaticity: bool, balance_its: bool, get_priority_graph: bool = False, format: Literal['auto', 'typesGH', 'tuple'] = 'typesGH', max_candidates: int | None = None) List[Tuple[Graph, Graph, Graph, Graph, str]][source]#
static add_hydrogen_nodes_multiple_utils(graph: Graph, node_id_pairs: Iterable[Tuple[int, int]], atom_map_update: bool = True) Graph[source]#
static complete_its(its: Graph, ignore_aromaticity: bool = False, balance_its: bool = True, get_priority_graph: bool = False, max_hydrogen: int = 7, format: Literal['auto', 'typesGH', 'tuple'] = 'auto', max_candidates: int | None = None) HCompletionResult[source]#
process_graph_data_parallel(graph_data_list: List[Dict[str, Graph]], its_key: str = 'ITS', rc_key: str = 'RC', n_jobs: int = 1, verbose: int = 0, ignore_aromaticity: bool = False, balance_its: bool = True, get_priority_graph: bool = False, max_hydrogen: int = 7, format: Literal['auto', 'typesGH', 'tuple'] = 'auto', max_candidates: int | None = None) List[Dict[str, Graph | None]][source]#
static process_multiple_hydrogens(graph_data: Dict[str, Graph], its_key: str, rc_key: str, react_graph: Graph, prod_graph: Graph, ignore_aromaticity: bool, balance_its: bool, get_priority_graph: bool = False, format: Literal['auto', 'typesGH', 'tuple'] = 'typesGH', max_candidates: int | None = None) Dict[str, Graph | None][source]#
static process_single_graph_data(graph_data: Dict[str, Graph], its_key: str = 'ITS', rc_key: str = 'RC', ignore_aromaticity: bool = False, balance_its: bool = True, get_priority_graph: bool = False, max_hydrogen: int = 7, format: Literal['auto', 'typesGH', 'tuple'] = 'auto', max_candidates: int | None = None) Dict[str, Graph | None][source]#
class synkit.Graph.Hyrogen.hcomplete.HCompletionResult(its: Graph | None, rc: Graph | None, reactant: Graph | None = None, product: Graph | None = None, signature: str | None = None, candidates: int = 0, reason: str = '', format: str = 'typesGH')[source]#

Bases: object

candidates: int = 0#
format: str = 'typesGH'#
its: Graph | None#
property ok: bool#
product: Graph | None = None#
rc: Graph | None#
reactant: Graph | None = None#
reason: str = ''#
signature: str | None = None#
class synkit.Graph.Hyrogen.hextend.HExtend[source]#

Bases: HComplete

static extend_its(its: Graph, ignore_aromaticity: bool = False, balance_its: bool = True, format: Literal['auto', 'typesGH', 'tuple'] = 'auto', max_candidates: int | None = None) Tuple[List[Graph], List[Graph], List[str]][source]#
static fit(data, its_key: str, rc_key: str, ignore_aromaticity: bool = False, balance_its: bool = True, n_jobs: int = 1, verbose: int = 0, format: Literal['auto', 'typesGH', 'tuple'] = 'auto', max_candidates: int | None = None, backend: str | None = None) List[source]#
static get_unique_graphs_for_clusters(graphs: List[Graph], cluster_indices: List[set]) List[Graph][source]#

ITS#

class synkit.Graph.ITS.its_builder.ITSBuilder[source]#

Bases: object

static ITSGraph(G: Graph, RC: Graph) Graph[source]#
static update_atom_map(graph: Graph) None[source]#
class synkit.Graph.ITS.its_construction.ITSConstruction[source]#

Bases: object

CORE_EDGE_DEFAULTS: Dict[str, Any] = {'bond_type': '', 'conjugated': False, 'ez_isomer': '', 'in_ring': False, 'kekule_order': 0.0, 'order': 0.0, 'pi_order': 0.0, 'sigma_order': 0.0}#
CORE_NODE_DEFAULTS: Dict[str, Any] = {'aromatic': False, 'atom_map': 0, 'charge': 0, 'element': '*', 'hcount': 0, 'hybridization': '', 'lone_pairs': 0, 'neighbors': <function ITSConstruction.<lambda>>, 'partial_charge': 0, 'radical': 0, 'valence_electrons': 0}#
static ITSGraph(G: Graph, H: Graph, ignore_aromaticity: bool = False, attributes_defaults: Dict[str, Any] | None = None, balance_its: bool = False, store: bool = False) Graph[source]#
static construct(G: Graph, H: Graph, *, ignore_aromaticity: bool = False, balance_its: bool = True, store: bool = True, node_attrs: List[str] | None = None, edge_attrs: List[str] | None = None, attributes_defaults: Dict[str, Any] | None = None) Graph[source]#
static get_node_attribute(graph: Graph, node: Hashable, attribute: str, default: Any) Any[source]#
static get_node_attributes_with_defaults(graph: Graph, node: Hashable, attributes_defaults: Dict[str, Any] = None) Tuple[source]#
static typesGH_info(node_attrs: List[str] | None = None, edge_attrs: List[str] | None = None) Dict[str, Dict[str, Tuple[type, Any]]][source]#
synkit.Graph.ITS.its_decompose.get_rc(ITS: Graph, element_key: List[str] = ['element', 'charge', 'typesGH', 'atom_map'], bond_key: str = 'order', standard_key: str = 'standard_order', disconnected: bool = False, keep_mtg: bool = False) Graph[source]#
synkit.Graph.ITS.its_decompose.its_decompose(its_graph: Graph, nodes_share='typesGH', edges_share='order')[source]#
class synkit.Graph.ITS.its_destruction.ITSDestruction(its_graph: Graph, node_attrs: List[str] | None = None, edge_share: str = 'order', edge_attrs: List[str] | None = None, clean_wildcard: bool = False)[source]#

Bases: object

property G: Graph#
property H: Graph#
decompose() Tuple[Graph, Graph][source]#
help() str[source]#
remove_wildcards(contract_neighbors: bool = False, element_attr: str = 'element', wildcard: Any = '*') Tuple[Graph, Graph][source]#
class synkit.Graph.ITS.its_expand.ITSExpand[source]#

Bases: object

static expand_aam_with_its(rsmi: str, relabel: bool = False, use_G: bool = True, preserve_older_map: bool = False) str[source]#
static reindex_side_graph_by_atom_map(graph, contiguous: bool = True)[source]#
class synkit.Graph.ITS.its_relabel.ITSRelabel[source]#

Bases: object

fit(rsmi: str) str[source]#
class synkit.Graph.ITS.normalize_aam.NormalizeAAM[source]#

Bases: object

static extract_subgraph(graph: Graph, indices: List[int]) Graph[source]#
fit(rsmi: str, fix_aam_indice: bool = True) str[source]#
static fix_kekulize(smiles: str) str[source]#
static fix_rsmi_kekulize(rsmi: str) str[source]#
reset_indices_and_atom_map(subgraph: Graph, aam_key: str = 'atom_map') Graph[source]#
class synkit.Graph.ITS.partial_its.PartialITS[source]#

Bases: object

static balance_valences(graph: Graph) Graph[source]#
static construct(G: Graph, H: Graph, *, ignore_aromaticity: bool = False, attributes_defaults: Dict[str, Any] | None = None, balance: bool = True) Graph[source]#

Mechanistic and Lewis-state utilities#

synkit.Graph.Mech.conversion.arrow_atom_maps(arrow_code: str) set[int][source]#
synkit.Graph.Mech.conversion.arrow_code_to_ef_arrow_code(arrow_code: str) str[source]#
synkit.Graph.Mech.conversion.atom_map_to_nodes(its) dict[int, list[Any]][source]#
synkit.Graph.Mech.conversion.bond_minus_type(reactant_order: float) str[source]#
synkit.Graph.Mech.conversion.bond_plus_type(reactant_order: float, product_order: float) str[source]#
synkit.Graph.Mech.conversion.build_its_from_rsmi(rsmi: str, arrow_code: str, expand_aam: bool = True, remove_non_arrow_maps: bool = True)[source]#
synkit.Graph.Mech.conversion.check_arrow_code_coverage(arrow_codes: list[str]) dict[str, Any][source]#
synkit.Graph.Mech.conversion.check_typed_conversion_quality(results: list[dict[str, Any]]) dict[str, Any][source]#
synkit.Graph.Mech.conversion.classify_arrow_shape(step: str) str[source]#
synkit.Graph.Mech.conversion.convert_arrow_code(arrow_code: str, its=None, strict_bond_lookup: bool = True) dict[str, Any][source]#
synkit.Graph.Mech.conversion.convert_reaction_arrow(reaction_smiles: str, arrow_code: str, orbital_class: str | None = None, expand_aam: bool = True, remove_non_arrow_maps: bool = True, strict_bond_lookup: bool = True) dict[str, Any][source]#
synkit.Graph.Mech.conversion.convert_record(record: dict[str, Any], reaction_key: str = 'SMIRKS', arrow_key: str = 'arrow_code', orbital_key: str = 'orbital pair classification', expand_aam: bool = True, remove_non_arrow_maps: bool = True, strict_bond_lookup: bool = True) dict[str, Any][source]#
synkit.Graph.Mech.conversion.convert_records(records: list[dict[str, Any]], reaction_key: str = 'SMIRKS', arrow_key: str = 'arrow_code', orbital_key: str = 'orbital pair classification', expand_aam: bool = True, remove_non_arrow_maps: bool = True, strict_bond_lookup: bool = True, keep_errors: bool = False) list[dict[str, Any]][source]#
synkit.Graph.Mech.conversion.debug_arrow_bond_orders(reaction_smiles: str, arrow_code: str, expand_aam: bool = True, remove_non_arrow_maps: bool = True, strict_bond_lookup: bool = True) None[source]#
synkit.Graph.Mech.conversion.debug_record(record: dict[str, Any], reaction_key: str = 'SMIRKS', arrow_key: str = 'arrow_code', orbital_key: str = 'orbital pair classification') dict[str, Any][source]#
synkit.Graph.Mech.conversion.duplicate_atom_maps_in_side(smiles: str) dict[int, int][source]#
synkit.Graph.Mech.conversion.ef_arrow_code_to_arrow_code(ef_arrow_code: str) str[source]#
synkit.Graph.Mech.conversion.ef_smirks_to_epd(ef_smirks: str, orbital_class: str | None = None, strict_bond_lookup: bool = True) dict[str, Any][source]#
synkit.Graph.Mech.conversion.epd_to_ef_smirks(complete_aam: str, epd: list[list[Any]]) str[source]#
synkit.Graph.Mech.conversion.extract_atom_maps_from_smiles(smiles: str) list[int][source]#
synkit.Graph.Mech.conversion.extract_order_from_edge_data(edge_data: Any) tuple[float, float][source]#
synkit.Graph.Mech.conversion.generic_convert_arrow_code(arrow_code: str) list[list[Any]][source]#
synkit.Graph.Mech.conversion.generic_convert_step(step: str) list[Any][source]#
synkit.Graph.Mech.conversion.get_its_bond_order(its, atom_a: int, atom_b: int, strict: bool = True, context: str = '', atom_map_nodes: dict[int, list[Any]] | None = None) tuple[float, float][source]#
synkit.Graph.Mech.conversion.get_unique_node_for_atom_map(its, atom_map: int, strict: bool = True, atom_map_nodes: dict[int, list[Any]] | None = None) Any | None[source]#
synkit.Graph.Mech.conversion.is_one(x: float, tol: float = 1e-06) bool[source]#
synkit.Graph.Mech.conversion.is_zero(x: float, tol: float = 1e-06) bool[source]#
synkit.Graph.Mech.conversion.parse_arrow_step(step: str) tuple[list[int], list[int]][source]#
synkit.Graph.Mech.conversion.parse_atom_list(text: str) list[int][source]#
synkit.Graph.Mech.conversion.remove_non_arrow_atom_maps(rsmi: str, arrow_code: str) str[source]#
synkit.Graph.Mech.conversion.split_arrow_code(arrow_code: str) list[str][source]#
synkit.Graph.Mech.conversion.split_ef_smirks(ef_smirks: str) tuple[str, str][source]#
synkit.Graph.Mech.conversion.typed_convert_arrow_code(arrow_code: str, its, strict_bond_lookup: bool = True) list[list[Any]][source]#
synkit.Graph.Mech.conversion.typed_convert_step(step: str, its, strict_bond_lookup: bool = True, atom_map_nodes: dict[int, list[Any]] | None = None) list[Any][source]#
synkit.Graph.Mech.conversion.validate_arrow_maps(rsmi: str, arrow_code: str, raise_on_arrow_duplicates: bool = True, raise_on_missing_arrow_maps: bool = True) dict[str, Any][source]#
class synkit.Graph.Mech.electron_accounting.ChargeEdit(atom_map: int, node: Any, delta: int | float, previous_charge: int | float, new_charge: int | float)[source]#

Bases: object

atom_map: int#
delta: int | float#
new_charge: int | float#
node: Any#
previous_charge: int | float#
class synkit.Graph.Mech.electron_accounting.ChargeRefresh(atom_map: int, node: Any, previous_charge: int | float, refreshed_charge: int | float, valence_electrons: float, nonbonding_electrons: float, bond_electrons: float)[source]#

Bases: object

atom_map: int#
bond_electrons: float#
node: Any#
nonbonding_electrons: float#
previous_charge: int | float#
refreshed_charge: int | float#
valence_electrons: float#
synkit.Graph.Mech.electron_accounting.atom_map_to_node(graph: Graph) dict[int, Any][source]#
synkit.Graph.Mech.electron_accounting.bond_electron_count(graph: Graph, node: Any) float[source]#
synkit.Graph.Mech.electron_accounting.bond_order_sum(graph: Graph, node: Any) float[source]#
synkit.Graph.Mech.electron_accounting.change_atom_charge(graph: Graph, atom_maps: list[int] | tuple[int, ...] | set[int], *, delta: int | float) list[ChargeEdit][source]#
synkit.Graph.Mech.electron_accounting.graph_to_sanitized_kekule_mol(graph: Graph) Mol[source]#
synkit.Graph.Mech.electron_accounting.nonbonding_electron_count(graph: Graph, node: Any) float[source]#
synkit.Graph.Mech.electron_accounting.recompute_charge(graph: Graph, node: Any) int | float[source]#
synkit.Graph.Mech.electron_accounting.refresh_changed_atom_charge(graph: Graph, atom_maps: list[int] | tuple[int, ...] | set[int]) list[ChargeRefresh][source]#
synkit.Graph.Mech.electron_accounting.refresh_electron_fields(graph: Graph, *, in_place: bool = False) Graph[source]#

Matcher#

class synkit.Graph.Matcher.approx_mcs.ApproxMCSMatcher(node_attrs: List[str] | None = None, node_defaults: List[Any] | None = None, allow_shift: bool = True, *, edge_attrs: List[str] | None = None, prune_wc: bool = False, prune_automorphisms: bool = False, wildcard_element: Any = '*', element_key: str = 'element', use_wl: bool = False, wl_max_iter: int = 3, wildcard_aware: bool = False)[source]#

Bases: object

find_common_subgraph(G1: Graph, G2: Graph, *, mcs: bool = False, mcs_mol: bool = False, max_seeds: int = 16, max_steps: int = 256) ApproxMCSMatcher[source]#
find_common_subgraph_approx(G1: Graph, G2: Graph, *, max_seeds: int = 16, max_steps: int = 256) ApproxMCSMatcher[source]#
find_rc_mapping(rc1: Any, rc2: Any, *, side: str = 'op', mcs: bool = True, mcs_mol: bool = False, component: bool = True, max_seeds: int = 16, max_steps: int = 256) ApproxMCSMatcher[source]#
get_mappings(direction: str = 'pattern_to_host') List[Dict[int, int]][source]#
property help: str#
property last_size: int#
property mapping_direction: str#
property mappings: List[Dict[int, int]]#
property num_mappings: int#
class synkit.Graph.Matcher.auto_est.AutoEst(graph: Graph, node_attrs: List[str] | None = None, edge_attrs: List[str] | None = None, max_iter: int = 10)[source]#

Bases: object

property anchor_component: FrozenSet[Hashable]#
components(nodes: Iterable[Hashable] | None = None) List[FrozenSet[Hashable]][source]#
property edge_attrs: Tuple[str, ...]#
fit() AutoEst[source]#
property graph: Graph#
property groups: List[List[Hashable]]#
property max_iter: int#
property n_groups: int#
property n_orbits: int#
property node_attrs: Tuple[str, ...]#
property node_colors: Dict[Hashable, int]#
orbit_components(nodes: Iterable[Hashable] | None = None) List[FrozenSet[int]][source]#
property orbit_index: Dict[Hashable, int]#
property orbits: List[FrozenSet[Hashable]]#
synkit.Graph.Matcher.auto_est.estimate_automorphism_groups(graph: Graph, node_attrs: Iterable[str] | None = None, edge_attrs: Iterable[str] | None = None, max_iter: int = 10) AutoEst[source]#
class synkit.Graph.Matcher.automorphism.Automorphism(graph: Graph, node_attr_keys: Sequence[str] | None = None, edge_attr_keys: Sequence[str] | None = None, *, anchor_largest_component: bool = True)[source]#

Bases: object

property anchor_component: frozenset[int | str | Tuple | object] | None#
property components: List[frozenset[int | str | Tuple | object]]#
property is_connected: bool#
property n_automorphisms: int#
property orbits: List[frozenset[int | str | Tuple | object]]#
class synkit.Graph.Matcher.batch_cluster.BatchCluster(node_label_names: List[str] = ['element', 'charge'], node_label_default: List[Any] = ['*', 0], edge_attribute: str = 'order', backend: str = 'nx')[source]#

Bases: object

available_backends() List[str][source]#
static batch_dicts(input_list, batch_size)[source]#
cluster(data: List[Dict], templates: List[Dict], rule_key: str = 'gml', attribute_key: str = 'WLHash') Tuple[List[Dict], List[Dict]][source]#
fit(data: List[Dict], templates: List[Dict], rule_key: str = 'gml', attribute_key: str = 'WLHash', batch_size: int | None = None) Tuple[List[Dict], List[Dict]][source]#
lib_check(data: Dict, templates: List[Dict], rule_key: str = 'gml', attribute_key: str = 'signature', nodeMatch: Callable | None = None, edgeMatch: Callable | None = None) Dict[source]#
synkit.Graph.Matcher.dedup_matches.deduplicate_matches_with_anchor(matches: Iterable[Dict[int, int]], *, pattern_orbits: Iterable[FrozenSet[int]] | None = None, pattern_anchor: FrozenSet[int] | None = None, host_orbits: Iterable[FrozenSet[int]] | None = None, host_anchor: FrozenSet[int] | None = None) List[Dict[int, int]][source]#
class synkit.Graph.Matcher.graph_cluster.GraphCluster(node_label_names: List[str] = ['element', 'charge'], node_label_default: List[Any] = ['*', 0], edge_attribute: str = 'order', backend: str = 'nx')[source]#

Bases: object

available_backends() List[str][source]#
fit(data: List[Dict], rule_key: str = 'gml', attribute_key: str = 'WLHash', strip: bool = False) List[Dict][source]#
iterative_cluster(rules: List[str], attributes: List[Any] | None = None, nodeMatch: Callable | None = None, edgeMatch: Callable | None = None) Tuple[List[Set[int]], Dict[int, int]][source]#
class synkit.Graph.Matcher.graph_matcher.GraphMatcherEngine(*, backend: str = 'nx', node_attrs: List[str] | None = None, edge_attrs: List[str] | None = None, wl1_filter: bool = False, max_mappings: int | None = 1)[source]#

Bases: object

static available_backends() List[str][source]#
get_mappings(host: Any, pattern: Any) List[Dict[int, int]][source]#
help() str[source]#
isomorphic(obj1: Any, obj2: Any) bool[source]#
synkit.Graph.Matcher.graph_morphism.find_graph_isomorphism(G1: Graph | DiGraph | MultiGraph | MultiDiGraph, G2: Graph | DiGraph | MultiGraph | MultiDiGraph, node_match: Callable[[Dict[str, Any], Dict[str, Any]], bool] | None = None, edge_match: Callable[[Dict[str, Any], Dict[str, Any]], bool] | None = None, use_defaults: bool = True, fast_invariant_check: bool = True, logger: Logger | None = None) Dict[Any, Any] | None[source]#
synkit.Graph.Matcher.graph_morphism.graph_isomorphism(graph_1: Graph, graph_2: Graph, node_match: Callable | None = None, edge_match: Callable | None = None, use_defaults: bool = False) bool[source]#
synkit.Graph.Matcher.graph_morphism.heuristics_MCCS(graphs: List[Graph], node_label_names: List[str] = ['element', 'charge'], node_label_default: List[Any] = ['*', 0], edge_attribute: str = 'standard_order') Graph[source]#
synkit.Graph.Matcher.graph_morphism.maximum_connected_common_subgraph(graph_1: Graph, graph_2: Graph, node_label_names: List[str] = ['element', 'charge'], node_label_default: List[Any] = ['*', 0], edge_attribute: str = 'standard_order') Graph[source]#
synkit.Graph.Matcher.graph_morphism.subgraph_isomorphism(child_graph: Graph, parent_graph: Graph, node_label_names: List[str] = ['element', 'charge'], node_label_default: List[Any] = ['*', 0], edge_attribute: str = 'order', use_filter: bool = False, check_type: str = 'induced', node_comparator: Callable[[Any, Any], bool] | None = None, edge_comparator: Callable[[Any, Any], bool] | None = None) bool[source]#
class synkit.Graph.Matcher.mcs_matcher.MCSMatcher(node_attrs: List[str] | None = None, node_defaults: List[Any] | None = None, allow_shift: bool = True, *, edge_attrs: List[str] | None = None, prune_wc: bool = False, prune_automorphisms: bool = False, wildcard_element: Any = '*', element_key: str = 'element')[source]#

Bases: object

find_common_subgraph(G1: Graph, G2: Graph, *, mcs: bool = False, mcs_mol: bool = False) MCSMatcher[source]#
find_rc_mapping(rc1: Any, rc2: Any, *, side: str = 'op', mcs: bool = True, mcs_mol: bool = False, component: bool = True) MCSMatcher[source]#
get_mappings(direction: str = 'pattern_to_host') List[Dict[int, int]][source]#
property help: str#
property last_size: int#
property mapping_direction: str#
property mappings: List[Dict[int, int]]#
property num_mappings: int#
class synkit.Graph.Matcher.multi_turbo_iso.MultiTurboISO(hosts: List[Graph], node_label: str | List[str] = 'label', edge_label: str | List[str] | None = None, distance_threshold: int = 5000)[source]#

Bases: object

property edge_label: List[str]#
property hosts: List[Graph]#
property node_label: List[str]#
property num_hosts: int#
search_many(patterns: List[Graph], *, prune: bool = False) List[Dict[int, bool | List[Dict[Any, Any]]]][source]#
search_one(Q: Graph, *, prune: bool = False) Dict[int, bool | List[Dict[Any, Any]]][source]#
class synkit.Graph.Matcher.orbit.OrbitAccuracy(approx_orbits: Iterable[FrozenSet[Hashable]], exact_orbits: Iterable[FrozenSet[Hashable]])[source]#

Bases: object

property approx_orbits: List[FrozenSet[Hashable]]#
compute(brute_force_pairs: bool = True) OrbitAccuracy[source]#
property confusion_map: Dict[int, Dict[int, int]]#
property exact_orbits: List[FrozenSet[Hashable]]#
help() str[source]#
property metrics: Dict[str, float]#
report(max_rows: int = 10) str[source]#
class synkit.Graph.Matcher.partial_matcher.PartialMatcher(host: Graph | Sequence[Graph], pattern: Graph, node_attrs: List[str], edge_attrs: List[str], *, strategy: Strategy = Strategy.COMPONENT, max_results: int | None = None, partial: bool = True, threshold: int | None = None, pre_filter: bool = False, prune_auto: bool = False, wl_max_iter: int = 10)[source]#

Bases: object

property approx_embedding_count: int#
estimate_embeddings_wl(k: int | None = None) PartialMatcher[source]#
static find_partial_mappings(host: Graph | Sequence[Graph], pattern: Graph, *, node_attrs: List[str], edge_attrs: List[str], k: int | None = None, strategy: Strategy = Strategy.COMPONENT, max_results: int | None = None, partial: bool = True, threshold: int | None = None, pre_filter: bool = False, prune_auto: bool = False, wl_max_iter: int = 10) List[Dict[int, int]][source]#
get_mappings() List[Dict[int, int]][source]#
property help: str#
property num_mappings: int#
property num_pattern_components: int#
property pre_filter: bool#
property threshold: int#
class synkit.Graph.Matcher.sing.SING(graph: Graph, max_path_length: int = 3, node_att: str | List[str] | None = None, edge_att: str | List[str] | None = 'order')[source]#

Bases: object

reindex(graph: Graph | None = None) None[source]#
search(query_graph: Graph, prune: bool = False, dedup_autos: bool = False) List[Dict[Any, Any]] | bool[source]#
class synkit.Graph.Matcher.subgraph_matcher.SubgraphMatch[source]#

Bases: object

static is_subgraph(pattern: Graph | str, host: Graph | str, node_label_names: List[str] = ['element', 'charge'], node_label_default: List[Any] = ['*', 0], edge_attribute: str = 'order', use_filter: bool = False, check_type: str = 'induced', backend: str = 'nx') bool[source]#
static rule_subgraph_morphism(rule_1: str, rule_2: str, use_filter: bool = False) bool[source]#
static subgraph_isomorphism(child_graph: Graph, parent_graph: Graph, node_label_names: List[str] = ['element', 'charge'], node_label_default: List[Any] = ['*', 0], edge_attribute: str = 'order', use_filter: bool = False, check_type: str = 'induced', node_comparator: Callable[[Any, Any], bool] | None = None, edge_comparator: Callable[[Any, Any], bool] | None = None) bool[source]#
class synkit.Graph.Matcher.subgraph_matcher.SubgraphSearchEngine[source]#

Bases: object

DEFAULT_THRESHOLD: int = 5000#
static find_subgraph_mappings(host: Graph, pattern: Graph, *, node_attrs: List[str], edge_attrs: List[str], strategy: str | Strategy = Strategy.COMPONENT, max_results: int | None = None, strict_cc_count: bool = True, threshold: int | None = None, pre_filter: bool = False) List[Dict[int, int]][source]#
property help: str#
class synkit.Graph.Matcher.turbo_iso.TurboISO(graph: Graph, node_label: str | List[str] = 'label', edge_label: str | List[str] | None = None, distance_threshold: int = 5000)[source]#

Bases: object

search(Q: Graph, prune: bool = False) List[Dict[Any, Any]] | bool[source]#
class synkit.Graph.Matcher.wl_sel.WLSel(fw: Sequence[Graph], bw: Sequence[Graph], element_key: str | None = 'element', node_attrs: Sequence[str] | None = None, edge_attrs: Sequence[str] | None = None, wl_iters: int = 1, min_score: float = 0.8, node_weight: float = 0.85)[source]#

Bases: object

build_signatures() WLSel[source]#
candidate_pairs(max_pairs: int | None = None) Generator[Tuple[int, int], None, None][source]#
filter_best_pairs(top_k: int = 1, min_score: float | None = None) WLSel[source]#
property pair_indices: List[Tuple[int, int]]#
property pair_scores: List[Tuple[int, int, float, Tuple[Any, ...]]]#
score_pairs(top_k: int | None = None, require_label_exact: bool = False) WLSel[source]#

MTG#

class synkit.Graph.MTG.mcs_matcher.MCSMatcher(node_label_names: List[str] | None = None, node_label_defaults: List[Any] | None = None, edge_attribute: str = 'order', allow_shift: bool = True)[source]#

Bases: object

find_common_subgraph(G1: Graph, G2: Graph, *, mcs: bool = False, mcs_mol: bool = False) None[source]#
find_rc_mapping(rc1, rc2, *, mcs: bool = False, mcs_mol: bool = False) None[source]#
get_mappings() List[Dict[int, int]][source]#
help() None[source]#
property last_size: int#
class synkit.Graph.MTG.mtg.MTG(sequences: List[Graph] | List[str], mappings: List[Dict[int, int]] | None = None, *, node_label_names: List[str] | None = None, canonicaliser: GraphCanonicaliser | None = None, mcs_mol: bool = False, mcs: bool = False, its_format: Literal['typesGH', 'tuple'] = 'tuple')[source]#

Bases: object

static describe() str[source]#
get_aam(*, directed: bool = False, explicit_h: bool = False) str[source]#
get_compose_its(*, directed: bool = False) Graph[source]#
get_its_steps(*, directed: bool = False) List[Graph][source]#
get_mtg(*, directed: bool = False) Graph[source]#
get_rsmi_steps(*, directed: bool = False, explicit_hydrogen: bool = False, sanitize: bool = True) List[str][source]#
property k: int#
property node_mapping: Dict[Tuple[int, int], int]#
to_dataframe()[source]#
synkit.Graph.MTG.mtg_explore.find_mtg(g1: Graph, g2: Graph, ground_truth: str, node_label_names: List[str] | None = None) MTG | None[source]#
synkit.Graph.MTG.utils.compute_standard_order(G: Graph, inplace: bool = False) Graph[source]#
synkit.Graph.MTG.utils.extract_order_norm(order_sequence: Sequence[Tuple[float, float] | Tuple[Set[float], Set[float]]]) Tuple[float, float] | None[source]#
synkit.Graph.MTG.utils.label_mtg_edges(G: Graph, inplace: bool = False) Graph[source]#
synkit.Graph.MTG.utils.normalize_hcount_and_typesGH(G: Graph | DiGraph | MultiGraph | MultiDiGraph) Graph | DiGraph | MultiGraph | MultiDiGraph[source]#
synkit.Graph.MTG.utils.normalize_order(G: Graph) Graph[source]#

Wildcard#

synkit.Graph.Wildcard.fuse_graph.find_wc_graph_isomorphism(G1: Graph | DiGraph | MultiGraph | MultiDiGraph, G2: Graph | DiGraph | MultiGraph | MultiDiGraph, node_match: Callable[[Dict[str, Any], Dict[str, Any]], bool] | None = None, edge_match: Callable[[Dict[str, Any], Dict[str, Any]], bool] | None = None, logger: Logger | None = None) Dict[Any, Any] | None[source]#
synkit.Graph.Wildcard.fuse_graph.fuse_wc_graphs(G1: Graph | DiGraph | MultiGraph | MultiDiGraph, G2: Graph | DiGraph | MultiGraph | MultiDiGraph, mapping: Dict[Any, Any], wildcard: str = '*', logger: Logger | None = None) Graph | DiGraph | MultiGraph | MultiDiGraph[source]#
class synkit.Graph.Wildcard.graph_wc.GraphCollectionSelector(graphs: Iterable[Graph])[source]#

Bases: object

describe() str[source]#
property filtered: List[Graph]#
reset() GraphCollectionSelector[source]#
select_by_node_attr(key: str = 'element', value: Any = '*', include: bool = True, match_any: bool = True) GraphCollectionSelector[source]#
select_by_node_attr_in(key: str = 'element', values: Iterable[Any] = ('*',), include: bool = True, match_any: bool = True) GraphCollectionSelector[source]#
select_by_node_pred(node_pred: Callable[[dict], bool], require_all_nodes: bool = False, include: bool = True) GraphCollectionSelector[source]#
select_by_pred(predicate: Callable[[Graph], bool]) GraphCollectionSelector[source]#
select_wc(*, element_key: str = 'element', wildcard: str = '*', select_with_wc: bool = True) GraphCollectionSelector[source]#
select_with_wc(element_key: str = 'element', wildcard: str = '*') GraphCollectionSelector[source]#
select_without_wc(element_key: str = 'element', wildcard: str = '*') GraphCollectionSelector[source]#
stats() dict[source]#
to_list() List[Graph][source]#
class synkit.Graph.Wildcard.its_merge.ITSMerge(G1: Graph | DiGraph | MultiGraph | MultiDiGraph, G2: Graph | DiGraph | MultiGraph | MultiDiGraph, mapping: Dict[Any, Any], *, types_key: str = 'typesGH', element_key: str = 'element', wildcard_element: str = '*', remove_wildcards: bool = True, logger: Logger | None = None)[source]#

Bases: object

property fused_graph: Graph | DiGraph | MultiGraph | MultiDiGraph#
property host_graph: Graph | DiGraph | MultiGraph | MultiDiGraph#
merge() ITSMerge[source]#
property pattern_graph: Graph | DiGraph | MultiGraph | MultiDiGraph#
property pattern_to_host: Dict[Any, Any]#
synkit.Graph.Wildcard.its_merge.fuse_its_graphs(G1: Graph | DiGraph | MultiGraph | MultiDiGraph, G2: Graph | DiGraph | MultiGraph | MultiDiGraph, mapping: Dict[Any, Any], *, types_key: str = 'typesGH', element_key: str = 'element', wildcard_element: str = '*', remove_wildcards: bool = True, logger: Logger | None = None) Graph | DiGraph | MultiGraph | MultiDiGraph[source]#
class synkit.Graph.Wildcard.radwc.RadWC[source]#

Bases: object

static describe()[source]#
static transform(rxn_smiles: str, start_map: int | None = None) str[source]#
class synkit.Graph.Wildcard.wc_matcher.WCMatcher(G1: Graph | DiGraph | MultiGraph | MultiDiGraph, G2: Graph | DiGraph | MultiGraph | MultiDiGraph, *, wildcard_element: str = '*', element_key: str = 'element', node_attrs: Sequence[str] | None = None, edge_attrs: Sequence[str] | None = None, node_match: Callable[[Dict[str, Any], Dict[str, Any]], bool] | None = None, edge_match: Callable[[Dict[str, Any], Dict[str, Any]], bool] | None = None, logger: Logger | None = None)[source]#

Bases: object

property core_mapping_without_wildcard_regions: Dict[Any, Any]#
fit() WCMatcher[source]#
property help: str#
property host_graph: Graph | DiGraph | MultiGraph | MultiDiGraph#
property is_match: bool#
property pattern_graph: Graph | DiGraph | MultiGraph | MultiDiGraph#
property wildcard_subgraph_mapping: Dict[Any, Set[Any]]#
synkit.Graph.Wildcard.wc_matcher.WildcardPatternMatcher#

alias of WCMatcher

class synkit.Graph.Wildcard.wildcard.WildCard[source]#

Bases: object

static add_unique_subgraph_with_wildcards(G: Graph, H: Graph, attributes_defaults: Dict[str, Any] | None = None, rebalance: bool = False) Tuple[Graph, Graph][source]#
static describe()[source]#
static from_rsmi(rsmi: str) Tuple[Graph, Graph][source]#
static rsmi_with_wildcards(rsmi: str, attributes_defaults: Dict[str, Any] | None = None, rebalance: bool = False) str[source]#
static to_smi(G: Graph) str[source]#