How this calculation works
Find a directed cycle with minimum average edge weight, allowing negative weights but distinguishing an acyclic graph from a zero-valued optimum. The page returns a complete cycle witness and its mean after bounded exact enumeration. This is a cycle-average objective, not a shortest-path or minimum-total-cycle calculation.
mu=min_directed_cycle Σw(e)/|cycle|.A worked example
The only simple cycle 0→1→2→0 has weights two, minus one, two. Its total is three over three edges, so mean weight is one; this is not the minimum single-edge weight.
Good to know
Directed simple n≤9, enumerated cycles capped300,000 states, negative weights permitted. No-cycle status distinct from numerical zero.
Reference: Method reference: Minimum mean cycle calculator for a directed weighted graph (opens in a new tab) ↗
Divide the cycle total by its edge count
For a directed cycle, mean weight is its sum of edge weights divided by the number of traversed edges. A cycle with larger total weight can have smaller mean if it contains more edges. Minimizing one quantity therefore does not automatically minimize the other.
The graph uses directed simple edges and zero-based vertices. Negative weights are permitted because the objective is over finite cycles rather than an unrestricted shortest walk repeatedly exploiting a negative cycle. Optional missing weights default to one, so an unweighted directed cycle has mean one rather than zero.
The Minimum feedback vertex set calculator for a directed graph asks which vertices must be deleted to make a DAG. A minimum mean cycle witness identifies one weighted cycle and leaves other cycles intact.
Verify the default three-edge cycle
The only simple cycle is zero→one→two→zero with edge weights two, minus one and two. Its total is three and its edge count is three, giving mean one. The negative edge does not make the whole mean negative, and its value minus one is not the answer.
If another two-edge cycle has weights zero and one, its mean is one half and it beats the default cycle even though both are valid directed cycles. This comparison makes the averaging step explicit. The returned vertex sequence repeats its first vertex at the end to show closure, but that repeated label is not an extra edge.
Use simple cycles without losing the minimum mean
A closed walk with repeated vertices can be decomposed into directed simple cycles. Its overall mean is a length-weighted average of their means, so it cannot be below every constituent cycle mean. A minimum can therefore be found among simple cycles when the graph has any directed cycle.
The solver enumerates these simple cycles and avoids repeated rotational descriptions by choosing a canonical starting label. Reversing a cycle is not automatically allowed: its reverse edges must exist in the directed input. Do not interpret an undirected drawing as permission to traverse an entered edge backward.
Check the returned witness
For consecutive labels in the cycle row, look up the directed input edge, add its weight and count the traversed pairs. Dividing that sum by the count reproduces the metric. The full enumeration proves that no supported cycle has a lower mean; the witness alone would only establish an upper bound.
Equal means can occur for cycles of different lengths and totals. The page returns one minimum witness rather than every tied cycle. Its particular starting vertex or orientation should not be given application-specific importance unless the graph itself supplies additional constraints that are not part of this optimization.
Read the no-cycle status distinctly
A DAG has no directed cycle, so its minimum mean cycle is undefined. The output reports a no-cycle status rather than a numeric zero. A graph with an actual zero-total cycle has mean zero, which is a mathematically different outcome.
Isolated vertices do not create cycles, and self-loops are rejected by the simple-graph contract. In a more general graph a self-loop would be a one-edge cycle with its own weight as mean. This page does not silently erase that unsupported candidate and then claim to solve the broader multigraph problem.
Understand bounded enumeration and other algorithms
The implementation supports at most nine vertices and caps search states at three hundred thousand. This direct enumeration is useful for transparent small examples but can grow rapidly in dense directed graphs. It is not a performance claim for Karp’s dynamic-programming method or other larger-network algorithms.
If the search cap is exceeded, no minimum is returned as certified. A best cycle seen before interruption is not sufficient proof of optimality. Narrow the graph or use a specialized solver rather than treating the limit message as evidence that cycles do not exist or that the current candidate is probably minimum.
Keep application quantities compatible with averaging
Edge weights must be additive quantities for which per-edge averaging is the intended objective. If one edge represents a different amount of time or work from another, average weight per edge may not equal average cost per unit time. A cycle-ratio problem with separate durations is a different specification.
The calculation can illuminate repetitive network behavior, but it does not automatically predict throughput, long-run stochastic reward or a feasible schedule with capacities. State what one edge traversal represents and why its count is the appropriate denominator before applying the returned mean to a real system.
A few questions, answered
Can the answer be negative?
Yes. Negative edge weights are allowed, and a negative-total directed cycle has a negative mean.
Why not minimize total cycle weight?
Total and mean are different objectives because cycles can have different lengths.
What does no directed cycle mean numerically?
The minimum is undefined and is reported as a status, not as zero.
Is the repeated final vertex counted twice?
It marks closure. Edge count is the number of consecutive traversal pairs, not the raw number of displayed labels.