Function Repository Resource:

XuIndex

Source Notebook

Compute the Xu index of an undirected graph or a molecule

Contributed by: Jan Mangaldan

ResourceFunction["XuIndex"][g]

computes the Xu index of the graph g.

ResourceFunction["XuIndex"][mol]

computes the Xu index of the molecule mol.

Details

For an undirected connected graph with n vertices, the Xu index is defined as , where δi is the degree of the ith vertex, and σi is the ith row sum of the graph distance matrix.
ResourceFunction["XuIndex"][mol] computes the Xu index of a molecule mol, where the hydrogens are ignored by default. Use the option setting IncludeHydrogensAll to account for hydrogens.
ResourceFunction["XuIndex"][entity] computes the Xu index of an entity of type "Chemical" or "Graph".

Examples

Basic Examples (1) 

The Xu index of a Petersen graph:

In[1]:=
ResourceFunction["XuIndex"][PetersenGraph[]]
Out[1]=

Scope (2) 

Compute the Xu index of a molecule:

In[2]:=
ResourceFunction["XuIndex"][
Molecule[{"C", "C", "C", "C", "C", "C", "C", "H", "H", "H", "H", "H", "H", "H", "H", "H", "H", "H", "H"}, {
Bond[{1, 2}, "Single"], 
Bond[{2, 3}, "Single"], 
Bond[{3, 4}, "Single"], 
Bond[{4, 5}, "Single"], 
Bond[{5, 6}, "Single"], 
Bond[{6, 7}, "Single"], 
Bond[{6, 1}, "Single"], 
Bond[{7, 3}, "Single"], 
Bond[{1, 8}, "Single"], 
Bond[{1, 9}, "Single"], 
Bond[{2, 10}, "Single"], 
Bond[{2, 11}, "Single"], 
Bond[{3, 12}, "Single"], 
Bond[{4, 13}, "Single"], 
Bond[{4, 14}, "Single"], 
Bond[{5, 15}, "Single"], 
Bond[{5, 16}, "Single"], 
Bond[{6, 17}, "Single"], 
Bond[{7, 18}, "Single"], 
Bond[{7, 19}, "Single"]}, {}]]
Out[2]=

Compute the Xu index of a named entity:

In[3]:=
ResourceFunction["XuIndex"][Entity["Graph", "TutteGraph"]]
Out[3]=

Options (2) 

IncludeHydrogens (2) 

By default, hydrogens are ignored in the computation of a molecule Xu index:

In[4]:=
ResourceFunction["XuIndex"][Molecule["neopentane"]]
Out[4]=

Use IncludeHydrogensAll to account for hydrogens:

In[5]:=
ResourceFunction["XuIndex"][Molecule["neopentane"], IncludeHydrogens -> All]
Out[5]=

Applications (2) 

A list of alkanes:

In[6]:=
Short[alks = {
Entity["Chemical", "Propane"], 
Entity["Chemical", "2Methylpropane"], 
Entity["Chemical", "Butane"], 
Entity["Chemical", "2,2Dimethylpropane"], 
Entity["Chemical", "2Methylbutane"], 
Entity["Chemical", "Pentane"], 
Entity["Chemical", "2,2Dimethylbutane"], 
Entity["Chemical", "2,3Dimethylbutane"], 
Entity["Chemical", "2Methylpentane"], 
Entity["Chemical", "3Methylpentane"], 
Entity["Chemical", "Hexane"], 
Entity["Chemical", "2,2,3Trimethylbutane"], 
Entity["Chemical", "2,2Dimethylpentane"], 
Entity["Chemical", "2,3Dimethylpentane"], 
Entity["Chemical", "2,4Dimethylpentane"], 
Entity["Chemical", "2Methylhexane"], 
Entity["Chemical", "3,3Dimethylpentane"], 
Entity["Chemical", "3Ethylpentane"], 
Entity["Chemical", "3Methylhexane"], 
Entity["Chemical", "Heptane"], 
Entity["Chemical", "Isoheptane"], 
Entity["Chemical", "2,2,3,3Tetramethylbutane"], 
Entity["Chemical", "2,2,3Trimethylpentane"], 
Entity["Chemical", "2,2,4Trimethylpentane"], 
Entity["Chemical", "2,2Dimethylhexane"], 
Entity["Chemical", "2,3,3Trimethylpentane"], 
Entity["Chemical", "2,3,4Trimethylpentane"], 
Entity["Chemical", "2,3Dimethylhexane"], 
Entity["Chemical", "2,4Dimethylhexane"], 
Entity["Chemical", "2,5Dimethylhexane"], 
Entity["Chemical", "2Methylheptane"], 
Entity["Chemical", "3,3Dimethylhexane"], 
Entity["Chemical", "3,4Dimethylhexane"], 
Entity["Chemical", "3Ethyl2Methylpentane"], 
Entity["Chemical", "3Ethyl3Methylpentane"], 
Entity["Chemical", "3Ethylhexane"], 
Entity["Chemical", "3Methylheptane"], 
Entity["Chemical", "4Methylheptane"], 
Entity["Chemical", "Octane"], 
Entity["Chemical", "2,2,3,3Tetramethylpentane"], 
Entity["Chemical", "2,2,3,4Tetramethylpentane"], 
Entity["Chemical", "2,2,3Trimethylhexane"], 
Entity["Chemical", "2,2,4,4Tetramethylpentane"], 
Entity["Chemical", "2,2,4Trimethylhexane"], 
Entity["Chemical", "2,2,5Trimethylhexane"], 
Entity["Chemical", "2,2Dimethylheptane"], 
Entity["Chemical", "2,3,3,4Tetramethylpentane"], 
Entity["Chemical", "2,3,3Trimethylhexane"], 
Entity["Chemical", "2,3,4Trimethylhexane"], 
Entity["Chemical", "2,3,5Trimethylhexane"], 
Entity["Chemical", "2,3Dimethylheptane"], 
Entity["Chemical", "2,4,4Trimethylhexane"], 
Entity["Chemical", "2,4Dimethyl3Ethylpentane"], 
Entity["Chemical", "2,4Dimethylheptane"], 
Entity["Chemical", "2,5Dimethylheptane"], 
Entity["Chemical", "2,6Dimethylheptane"], 
Entity["Chemical", "2Methyloctane"], 
Entity["Chemical", "3,3,4Trimethylhexane"], 
Entity["Chemical", "3,3Diethylpentane"], 
Entity["Chemical", "3,3Dimethylheptane"], 
Entity["Chemical", "3,4Dimethylheptane"], 
Entity["Chemical", "3,5Dimethylheptane"], 
Entity["Chemical", "3Ethyl2,2Dimethylpentane"], 
Entity["Chemical", "3Ethyl2,3Dimethylpentane"], 
Entity["Chemical", "3Ethyl2Methylhexane"], 
Entity["Chemical", "3Ethyl3Methylhexane"], 
Entity["Chemical", "3Ethyl4Methylhexane"], 
Entity["Chemical", "3Ethylheptane"], 
Entity["Chemical", "3Methyloctane"], 
Entity["Chemical", "4,4Dimethylheptane"], 
Entity["Chemical", "4Ethyl2Methylhexane"], 
Entity["Chemical", "4Ethylheptane"], 
Entity["Chemical", "4Methyloctane"], 
Entity["Chemical", "Isononane"], 
Entity["Chemical", "Nonane"], 
Entity["Chemical", "2,2,3,3Tetramethylhexane"], 
Entity["Chemical", "2,2,4,5TetramethylHexane"], 
Entity["Chemical", "2,2,4Trimethylheptane"], 
Entity["Chemical", "2,2,5,5Tetramethylhexane"], 
Entity["Chemical", "2,2Dimethyloctane"], 
Entity["Chemical", "2,3,4Trimethylheptane"], 
Entity["Chemical", "2,3,5Trimethylheptane"], 
Entity["Chemical", "2,3,6Trimethylheptane"], 
Entity["Chemical", "2,3Dimethyloctane"], 
Entity["Chemical", "2,4,4Trimethylheptane"], 
Entity["Chemical", "2,4,5TrimethylHeptane"], 
Entity["Chemical", "2,4,6Trimethylheptane"], 
Entity["Chemical", "2,4Dimethyloctane"], 
Entity["Chemical", "2,5,5Trimethylheptane"], 
Entity["Chemical", "2,5Dimethyloctane"], 
Entity["Chemical", "2,6Dimethyloctane"], 
Entity["Chemical", "2,7Dimethyloctane"], 
Entity["Chemical", "2Methylnonane"], 
Entity["Chemical", "3,3,4,4Tetramethylhexane"], 
Entity["Chemical", "3,3,4Trimethylheptane"], 
Entity["Chemical", "3,3,5Trimethylheptane"], 
Entity["Chemical", "3,3Dimethyloctane"], 
Entity["Chemical", "3,4,5Trimethylheptane"], 
Entity["Chemical", "3,4DiethylHexane"], 
Entity["Chemical", "3,4Dimethyloctane"], 
Entity["Chemical", "3,5Dimethyloctane"], 
Entity["Chemical", "3,6Dimethyloctane"], 
Entity["Chemical", "3Ethyl2Methylheptane"], 
Entity["Chemical", "3Ethyl3Methylheptane"], 
Entity["Chemical", "3Ethyl5Methylheptane"], 
Entity["Chemical", "3Ethyloctane"], 
Entity["Chemical", "3Methylnonane"], 
Entity["Chemical", "4,4DimethylOctane"], 
Entity["Chemical", "4,5Dimethyloctane"], 
Entity["Chemical", "4Ethyl2,2Dimethylhexane"], 
Entity["Chemical", "4Ethyloctane"], 
Entity["Chemical", "4Isopropylheptane"], 
Entity["Chemical", "4Methylnonane"], 
Entity["Chemical", "4Propylheptane"], 
Entity["Chemical", "5Ethyl2Methylheptane"], 
Entity["Chemical", "5Methylnonane"], 
Entity["Chemical", "Decane"], 
Entity["Chemical", "Isodecane"], 
Entity["Chemical", "2Methyldecane"], 
Entity["Chemical", "3Methyldecane"], 
Entity["Chemical", "4Methyldecane"], 
Entity["Chemical", "Undecane"], 
Entity["Chemical", "2,2,4,4,6PentamethylHeptane"], 
Entity["Chemical", "2,2,4,6,6Pentamethylheptane"], 
Entity["Chemical", "2Methylundecane"], 
Entity["Chemical", "Dodecane"], 
Entity["Chemical", "Isododecane"]}]
Out[6]=

Compute their Xu indices:

In[7]:=
xl = ResourceFunction["XuIndex"] /@ EntityValue[alks, "Molecule"];

Get their boiling points:

In[8]:=
bp = QuantityMagnitude[EntityValue[alks, "BoilingPoint"], "DegreesCelsius"];

The Xu indices show a strong correlation with the boiling points of alkanes. Visualize the trend:

In[9]:=
da = Transpose[{xl, bp}];
ListPlot[da, Epilog -> {Directive[
AbsoluteThickness[2], 
RGBColor[0.368417, 0.506779, 0.709798]], ResourceFunction["TrendLine"][da]}, {Axes -> None, Frame -> True}]
Out[10]=

Compute the correlation coefficient:

In[11]:=
Correlation[xl, bp]
Out[11]=

Generate all alkanes with 7 carbon atoms (heptanes) using the resource function AlkaneIsomers:

In[12]:=
heptanes = ResourceFunction["AlkaneIsomers"][7]
Out[12]=

Sort the heptane isomers by their Xu index. This effectively sorts them from "most branched" to "least branched":

In[13]:=
SortBy[heptanes, ResourceFunction["XuIndex"]]
Out[13]=

Requirements

Wolfram Language 12.3 (May 2021) or above

Version History

  • 1.0.0 – 18 December 2023

Source Metadata

Related Resources

Author Notes

XuIndex currently does not implement Ren's modification for molecules with multiple bonds and/or heteroatoms; this extension is reserved for a future update.

License Information