Overview
Many operations are executed on the whole graph, including the full history. This section describes how to use a GraphView to look at a subset of your data without having to re-ingest it.
A GraphView is a snapshot of a graph that is used when reading data and running algorithms. Generally, you will use a Graph object when building or mutating a graph and for global queries, but use a GraphView to extract data from specific regions of interest. You can create graph views using either time functions like window(), at(), and before(), or filters to select a narrower subset of your graph. You can then run your queries against the GraphView instead of the Graph object.
Raphtory can maintain hundreds of thousands of graph views in parallel and allows chaining view functions together to create as specific a view as is required for your use case. A unified API means that all functions that can be called on a Graph, Node, or Edge can also be applied to this subset.
View Propagation
When you apply a view restriction — whether a time filter like window(), a layer with layer(), or a node/edge filter — the restriction persists to all subsequent operations in the chain. This means any nodes, edges, or neighbours you access will also be filtered by the same view.
For example, if you call g.window(start, end).node("FELIPE").neighbours, both Felipe and all returned neighbours are restricted to the specified window. The same applies to layers, subgraphs, and other view operations.
If you need to apply different restrictions at different steps in a traversal, use the [] filter syntax with filter expressions instead. This applies a one-off filter without creating a persistent view, giving you fine-grained control over each step.
For a detailed comparison of views vs filters and examples of multi-step queries, see the Chaining Queries documentation.
This chapter will continue using the baboon graph described in the Querying Introduction.