 The complete graph K4 has the ten matchings shown, so its Hosoya index is ten, the maximum for any four-vertex graph.

The Hosoya index, also known as the Z index, of a graph is the total number of matchings in it. The Hosoya index is always at least one, because the empty set of edges is counted as a matching for this purpose. Equivalently, the Hosoya index is the number of non-empty matchings plus one. The index is named after Haruo Hosoya. It is used as a topological index in chemical graph theory.

Complete graphs have the largest Hosoya index for any given number of vertices; their Hosoya indices are the telephone numbers.

## History

This graph invariant was introduced by Haruo Hosoya in 1971.  It is often used in chemoinformatics for investigations of organic compounds.  

In his article, "The Topological Index Z Before and After 1971," on the history of the notion and the associated inside stories, Hosoya writes that he introduced the Z index to report a good correlation of the boiling points of alkane isomers and their Z indices, basing on his unpublished 1957 work carried out while he was an undergraduate student at the University of Tokyo. 

## Example

A linear alkane, for the purposes of the Hosoya index, may be represented as a path graph without any branching. A path with one vertex and no edges (corresponding to the methane molecule) has one (empty) matching, so its Hosoya index is one; a path with one edge ( ethane) has two matchings (one with zero edges and one with one edges), so its Hosoya index is two. Propane (a length-two path) has three matchings: either of its edges, or the empty matching. n- butane (a length-three path) has five matchings, distinguishing it from isobutane which has four. More generally, a matching in a path with $k$ edges either forms a matching in the first $k-1$ edges, or it forms a matching in the first $k-2$ edges together with the final edge of the path. This case analysis shows that the Hosoya indices of linear alkanes obey the recurrence governing the Fibonacci numbers, and because they also have the same base case they must equal the Fibonacci numbers. The structure of the matchings in these graphs may be visualized using a Fibonacci cube.

The largest possible value of the Hosoya index, on a graph with $n$ vertices, is given by the complete graph $K_{n}$ . The Hosoya indices for the complete graphs are the telephone numbers

1, 1, 2, 4, 10, 26, 76, 232, 764, 2620, 9496, ... (sequence in the OEIS).

These numbers can be expressed by a summation formula involving factorials, as

$\sum _{k=0}^{\lfloor n/2\rfloor }{\frac {n!}{2^{k}\cdot k!\cdot \left(n-2k\right)!}}.$ Every graph that is not complete has a smaller Hosoya index than this upper bound. 

## Algorithms

The Hosoya index is #P-complete to compute, even for planar graphs.  However, it may be calculated by evaluating the matching polynomial mG at the argument 1.  Based on this evaluation, the calculation of the Hosoya index is fixed-parameter tractable for graphs of bounded treewidth  and polynomial (with an exponent that depends linearly on the width) for graphs of bounded clique-width.  The Hosoya index can be efficiently approximated to any desired constant approximation ratio using a fully-polynomial randomized approximation scheme.