invalidate_cache: Invalidate the cache of a graph

View source: R/interface.R

invalidate_cacheR Documentation

Invalidate the cache of a graph

Description

igraph graphs cache some basic properties (such as whether the graph is a DAG or whether it is simple) in an internal data structure for faster repeated queries. This function invalidates the cache, forcing a recalculation of the cached properties the next time they are needed.

Usage

invalidate_cache(graph)

Arguments

graph

The graph whose cache is to be invalidated.

Details

You should not need to call this function during normal usage; however, it may be useful for debugging cache-related issues. A tell-tale sign of an invalid cache entry is when the result of a cached function (such as is_dag() or is_simple()) changes after calling this function.

Value

The graph with its cache invalidated. Since the graph is modified in place in R as well, you can also ignore the return value.

Related documentation in the C library

invalidate_cache()

Examples

g <- make_ring(10)
# Cache is populated when calling is_simple()
is_simple(g)
# Invalidate cache (for debugging purposes)
invalidate_cache(g)
# Result should be the same
is_simple(g)

igraph documentation built on April 21, 2026, 5:06 p.m.