Advanced maths

Ihara graph zeta calculator with a nonbacktracking cycle determinant

Compute the exact reciprocal Ihara zeta polynomial from nonbacktracking directed-edge walks.

Your numbers

Valid JSON; preserve the shown array or object structure.

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

The nonbacktracking matrix uses directed edges as states, so each undirected input edge contributes two orientations. A transition is allowed when the first edge's head is the next edge's tail, except that immediately reversing the same edge is forbidden.

THE FORMULAOrient each original edge both ways. Define B[e,f]=1 iff head(e)=tail(f) and f is not reverse(e). Compute det(I−uB) with exact polynomial arithmetic. Prefer Bass determinant identity (1−u²)^(m−n) det(I−uA+u²(D−I)) with exact division when exponentnegative; handle edgeless/tree components explicitly or use direct2m determinant. Output reciprocal zeta denominator; obtain traceB^k coefficients for diagnostics. Never include immediate backtracking or confuse primitive unoriented cycles with oriented equivalence conventions.

A worked example

With the prefilled inputs, degree = 6.

Good to know

Ascending coefficients of det(I−uB); Ihara zeta is its reciprocal. Nonbacktracking dart adjacency forbids immediate edge reversal.

Exclude immediate reversal from the edge walk

The nonbacktracking matrix uses directed edges as states, so each undirected input edge contributes two orientations. A transition is allowed when the first edge's head is the next edge's tail, except that immediately reversing the same edge is forbidden.

This differs from the adjacency matrix, whose states are vertices and whose closed walks freely include backtracking. The Ihara zeta function packages primitive closed nonbacktracking cycles under its stated orientation convention. Using the vertex adjacency matrix directly would count a different collection of walks.

Triangle reciprocal Ihara zeta polynomialTwo directed nonbacktracking triangle cycles0120→1→2→00→2→1→0ζ(u)⁻¹ = (1 − u³)²= 1 − 2u³ + u⁶trace B = 0 trace B² = 0 trace B³ = 6
Scroll across to see the full diagram.
The directed-edge transition graph has two directed 3-cycles, giving reciprocal zeta (1−u³)². Immediate edge reversal is excluded.

Compare with the Spanning tree count calculator using a graph Laplacian. Compute nonbacktracking closed-cycle generating information rather than Laplacian spanningtree counts.

Read the denominator rather than a finite cycle list

Use the prefilled input structure and preserve the declared column or index order. The reported polynomial is the inverse zeta function det(I−uB). The zeta function itself is its reciprocal, not a polynomial in general. A finite graph can have infinitely many nonbacktracking closed walks, so a finite list of short cycles is not a complete substitute.

Coefficients are exact integers for an unweighted graph. Keep their order explicit, such as ascending powers of u, and retain zero coefficients where needed. Trimming or reversing an array carelessly can make a correct determinant appear to describe a different function.

Build the directed-edge transition matrix

For every undirected edge, create both endpoint orders and record which state is the reverse of which. Populate the transition matrix using endpoint agreement and the reverse-edge exclusion. This state construction should be directly inspectable for small examples.

The determinant can be computed with exact polynomial arithmetic or cross-checked against Bass's smaller vertex-matrix identity. When that identity has a negative exponent of one minus u squared, cancellation must be exact; replacing division by floating evaluation near a root would obscure the polynomial result.

The triangle has two directed primitive cycles

A triangle allows a nonbacktracking traversal clockwise or anticlockwise. Once a directed edge is chosen, continuation around the triangle is forced. The six directed-edge states therefore form two disjoint directed cycles of length three in the transition graph.

Each directed three-cycle contributes a factor one minus u cubed, giving inverse zeta equal to one minus twice u cubed plus u to the sixth. The trace of B cubed is six, while traces of B and B squared vanish, providing additional independent small checks.

Use the directed states in the SVG

Draw the triangle with both directional traversal cycles indicated and label its six edge states separately from the three original vertices. The figure should explain why the determinant degree follows the directed-edge matrix rather than simply repeating a generic undirected triangle.

A coefficient table can accompany selected traces of powers of B. The relation between the logarithm of zeta and closed-walk traces provides a useful consistency check, but those traces should not be mislabeled as counts of distinct primitive cycles without accounting for starting positions and repetitions.

Trees have no surviving nonbacktracking cycles

In a finite tree, a closed walk must eventually reverse some edge if it is to return, so there are no closed nonbacktracking cycles. Its Ihara zeta function is one, and the inverse determinant polynomial should reduce exactly to the constant one despite the matrix having directed-edge states.

Attaching a tree branch to a cyclic core does not create a new closed nonbacktracking cycle through that branch. This makes leaf attachments a useful test of the implementation and the Bass-identity cancellations. The original adjacency spectrum can change even when the Ihara zeta does not.

Keep arithmetic and size caps visible

The proposed edge limit bounds the directed matrix dimension and the possible polynomial degree. Exact determinant coefficients can still grow, so the engine needs integer growth and operation caps. Exceeding a cap should produce an unresolved computation rather than rounded coefficients presented as exact.

Test trees, a single cycle, disconnected cycles and a graph with a leaf attached to a cycle. Compare direct directed-edge determinants with the Bass identity where both are supported. These checks target orientation, backtracking exclusion and exact cancellation separately. The public prefill is this triangle. Coefficients are returned as exact integer strings in ascending powers, so the list one,zero,zero,minus two,zero,zero,one means one minus twice u cubed plus u to the sixth. The degree is six and there are six directed edge states. Zero coefficients are positional information, not missing data. Ascending coefficients of det(I−uB); Ihara zeta is its reciprocal. Nonbacktracking dart adjacency forbids immediate edge reversal.

A few questions, answered

Why does each undirected edge create two matrix states?

The walk must remember its direction to decide whether the next step immediately reverses it.

Is the output polynomial the zeta function itself?

It is the inverse zeta denominator det(I−uB). The zeta function is the reciprocal of that polynomial.

Why is the triangle denominator squared?

Clockwise and anticlockwise primitive directed cycles both contribute under the stated orientation convention.

What should a tree return?

Its inverse zeta polynomial and zeta function are both one because it has no closed nonbacktracking cycle.

Find your calculator

Start typing to explore the library.