{"id":19722414,"url":"https://github.com/tinaccil/connectivity_chemical_graph","last_synced_at":"2025-10-11T17:32:54.004Z","repository":{"id":54204715,"uuid":"341577615","full_name":"TinacciL/Connectivity_chemical_graph","owner":"TinacciL","description":"Python script that permits to encode molecules as molecular graph and compare easily the connectivity of two molecules","archived":false,"fork":false,"pushed_at":"2022-01-28T17:27:30.000Z","size":40,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-28T00:35:34.757Z","etag":null,"topics":["chemical-graph","chemoinformatics","encode-molecules","isomorphism"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TinacciL.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-23T14:15:54.000Z","updated_at":"2024-01-04T22:47:17.000Z","dependencies_parsed_at":"2022-08-13T09:10:34.304Z","dependency_job_id":null,"html_url":"https://github.com/TinacciL/Connectivity_chemical_graph","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TinacciL/Connectivity_chemical_graph","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TinacciL%2FConnectivity_chemical_graph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TinacciL%2FConnectivity_chemical_graph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TinacciL%2FConnectivity_chemical_graph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TinacciL%2FConnectivity_chemical_graph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TinacciL","download_url":"https://codeload.github.com/TinacciL/Connectivity_chemical_graph/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TinacciL%2FConnectivity_chemical_graph/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279008112,"owners_count":26084396,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chemical-graph","chemoinformatics","encode-molecules","isomorphism"],"created_at":"2024-11-11T23:17:16.920Z","updated_at":"2025-10-11T17:32:53.987Z","avatar_url":"https://github.com/TinacciL.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Connectivity in chemical graph\nThis is a Python 3.8 script that permits to encode molecules as molecular graph and compare the connectivity of two molecules.\n\n## Installation\n\nThis program used a python3 interface, to run this code you must install on your machine this list of packages:\n\n* ```networkx```\n* ```ase```\n\n## Script Structure\n\n0 - Import the required packages\n\n```python\nimport networkx as nx\nfrom ase import io, neighborlist, atoms\n```\n\n1 - Function that encode the molecule from the Euclidean space (.xyz) to the corrisponding graph structure, and you will call it in the main of the code.\n\n```python\ndef FromXYZtoGraph(input_file):\n    atoms = ['H','He','Li','C','N','O','F','Na','Si','P','S','Cl']\n    atomic_numb = [1,2,3,6,7,8,9,11,14,15,16,17]\n    mol = io.read(input_file)\n    #compute neighbor of the atoms in xyz format\n    cutOff = neighborlist.natural_cutoffs(mol)\n    neighborList = neighborlist.NeighborList(cutOff, self_interaction=False, bothways=True)\n    neighborList.update(mol)\n    #compure adjacency matrix and atoms list\n    adj_matrix = neighborList.get_connectivity_matrix(sparse=False)\n    Natom_list = mol.get_atomic_numbers()\n    atoms_list = []\n    for i,item in enumerate(Natom_list):\n        for k in range(len(atomic_numb)):\n            if item == atomic_numb[k]:\n                atoms_list.append(atoms[k]) \n    #convert in networkx-molecules graph\n    G=nx.from_numpy_matrix(adj_matrix)\n    for i,item in enumerate(atoms_list):\n        tmp_attr = {'atom': item}\n        G.nodes[i].update(tmp_attr.copy())\n    return(G)\n```\n2 - Code main: computing the isomorphism between two molecular graph object.\n\n   2.1 - Encode the molecoles from .xyz to graph molecule objects, modify the path (example \"pathToMolecules/mol_0.xyz\") where your .xyz is locate.\n```python\nmol_0 = FromXYZtoGraph(pathToMolecules/mol_0.xyz)\nmol_1 = FromXYZtoGraph(pathToMolecules/mol_1.xyz)\n```\n\n   2.2 - Run the function to control the isomorphism between the two molecules\n\n```python\nprop = 'atom'\nnm = nx.algorithms.isomorphism.categorical_node_match(prop,prop)\n\nif nx.is_isomorphic(mol0,mol_1,node_match=nm):\n    print('Are isomorphic!')\nelse:\n    print('Are NOT isomorphic!')\n```\n\n## Associated publication\nPlease reffer to the following publication to cite our work or retrieve the info:\n\n[Structures and Properties of Known and Postulated Interstellar Cations, L.Tinacci et al 2021 ApJS 256 35](https://doi.org/10.3847/1538-4365/ac194c) \n\n(https://doi.org/10.3847/1538-4365/ac194c)\n\n## Acknowledgments\nThis project has received funding within the European Union’s Horizon 2020 research and innovation programme from the Marie Sklodowska-Curie for the project ”Astro-Chemical Origins” (ACO), grant agreement No 811312.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinaccil%2Fconnectivity_chemical_graph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftinaccil%2Fconnectivity_chemical_graph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinaccil%2Fconnectivity_chemical_graph/lists"}