Struct graphannis::Graph [−][src]
pub struct Graph<CT> where
CT: ComponentType, { /* fields omitted */ }
Expand description
A representation of a graph including node annotations and edges. Edges are partioned into components and each component is implemented by specialized graph storage implementation.
Graphs can have an optional location on the disk. In this case, changes to the graph via the apply_update(…) function are automatically persisted to this location.
Implementations
Create a new and empty instance without any location on the disk.
Create a new instance without any location on the disk but with the default graph storage components.
Load the graph from an external location. This sets the location of this instance to the given location.
location
- The path on the diskpreload
- Iftrue
, all components are loaded from disk into main memory.
Save the current database to a location
on the disk, but do not remember this location.
Save the current database at a new location
and remember it as new internal location.
pub fn apply_update<F>(
&mut self,
u: &mut GraphUpdate,
progress_callback: F
) -> Result<(), GraphAnnisCoreError> where
F: Fn(&str),
pub fn apply_update<F>(
&mut self,
u: &mut GraphUpdate,
progress_callback: F
) -> Result<(), GraphAnnisCoreError> where
F: Fn(&str),
Apply a sequence of updates (u
parameter) to this graph.
If the graph has a location on the disk, the changes are persisted.
A function to persist the changes of a write-ahead-log update on the disk. Should be run in a background thread.
pub fn calculate_component_statistics(
&mut self,
c: &Component<CT>
) -> Result<(), GraphAnnisCoreError>
pub fn calculate_component_statistics(
&mut self,
c: &Component<CT>
) -> Result<(), GraphAnnisCoreError>
Makes sure the statistics for the given component are up-to-date.
pub fn get_or_create_writable(
&mut self,
c: &Component<CT>
) -> Result<&mut dyn WriteableGraphStorage, GraphAnnisCoreError>
pub fn get_or_create_writable(
&mut self,
c: &Component<CT>
) -> Result<&mut dyn WriteableGraphStorage, GraphAnnisCoreError>
Gets the the given component. If the component does not exist yet, it creates a new empty one. If the existing component is non-writable, a writable copy of it is created and returned.
Returns true
if the graph storage for this specific component is loaded and ready to use.
Ensure that the graph storages for all component are loaded and ready to use.
Ensure that the graph storage for a specific component is loaded and ready to use.
Get a read-only graph storage copy for the given component c
.
pub fn get_graphstorage_as_ref(
&'a self,
c: &Component<CT>
) -> Option<&'a (dyn GraphStorage + 'a)>
pub fn get_graphstorage_as_ref(
&'a self,
c: &Component<CT>
) -> Option<&'a (dyn GraphStorage + 'a)>
Get a read-only graph storage reference for the given component c
.
Get a read-only reference to the node annotations of this graph
Get a mutable reference to the node annotations of this graph
Returns all components of the graph given an optional type (ctype
) and name
.
This allows to filter which components to receive.
If you want to retrieve all components, use None
as value for both arguments.
Trait Implementations
Measure the heap usage of all descendant heap-allocated structures, but not the space taken up by the value itself. Read more