# rustworkx.is_subgraph_isomorphic#

is_subgraph_isomorphic(first, second, node_matcher=None, edge_matcher=None, id_order=False, induced=True, call_limit=None)[source]#

Determine if 2 graphs are subgraph isomorphic

This checks if 2 graphs are subgraph isomorphic both structurally and also comparing the node and edge data using the provided matcher functions. The matcher functions take in 2 data objects and will compare them. Since there is an ambiguity in the term ‘subgraph’, do note that we check for an node-induced subgraph if argument induced is set to True. If it is set to False, we check for a non induced subgraph, meaning the second graph can have fewer edges than the subgraph of the first. By default it’s True. A simple example that checks if they’re just equal would be:

```graph_a = rustworkx.PyGraph()
graph_b = rustworkx.PyGraph()
rustworkx.is_subgraph_isomorphic(graph_a, graph_b,
lambda x, y: x == y)
```
Parameters:
• first – The first graph to compare. Can either be a `PyGraph` or `PyDiGraph`.

• second – The second graph to compare. Can either be a `PyGraph` or `PyDiGraph`. It should be the same type as the first graph.

• node_matcher (callable) – A python callable object that takes 2 positional one for each node data object. If the return of this function evaluates to True then the nodes passed to it are viewed as matching.

• edge_matcher (callable) – A python callable object that takes 2 positional one for each edge data object. If the return of this function evaluates to True then the edges passed to it are viewed as matching.

• id_order (bool) – If set to `True` this function will match the nodes in order specified by their ids. Otherwise it will default to a heuristic matching order based on [VF2] paper.

• induced (bool) – If set to `True` this function will check the existence of a node-induced subgraph of first isomorphic to second graph. Default: `True`.

• call_limit (int) – An optional bound on the number of states that VF2 algorithm visits while searching for a solution. If it exceeds this limit, the algorithm will stop and return `False`.

Returns:

`True` if there is a subgraph of first isomorphic to second , `False` if there is not.

Return type:

bool
{"ft_lang_label":"__label__en","ft_lang_prob":0.81272155,"math_prob":0.9193454,"size":2170,"snap":"2023-40-2023-50","text_gpt3_token_len":513,"char_repetition_ratio":0.12419206,"word_repetition_ratio":0.19596542,"special_character_ratio":0.21705069,"punctuation_ratio":0.11363637,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.98594266,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-12-02T12:53:56Z\",\"WARC-Record-ID\":\"<urn:uuid:7ff870c9-8b7a-458e-80bf-c014682c467d>\",\"Content-Length\":\"107824\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:e9264139-f881-4a38-9593-e898ed5dc999>\",\"WARC-Concurrent-To\":\"<urn:uuid:cf82deec-5a49-403d-9c39-2003da53bcbb>\",\"WARC-IP-Address\":\"104.18.10.227\",\"WARC-Target-URI\":\"https://qiskit.org/ecosystem/rustworkx/apiref/rustworkx.is_subgraph_isomorphic.html\",\"WARC-Payload-Digest\":\"sha1:WMXOWDBX5BDRO7UNTPVPJCMVSZ5GY5ZU\",\"WARC-Block-Digest\":\"sha1:GWSP6UURLKYKXFCYNFWPK7BIPHYOOH6A\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-50/CC-MAIN-2023-50_segments_1700679100399.81_warc_CC-MAIN-20231202105028-20231202135028-00284.warc.gz\"}"}