[][src]Struct graphannis::Graph

pub struct Graph<CT> where
    CT: ComponentType
{ /* fields omitted */ }

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

impl<CT> Graph<CT> where
    CT: ComponentType
[src]

pub fn new(disk_based: bool) -> Result<Graph<CT>, Error>[src]

Create a new and empty instance without any location on the disk.

pub fn with_default_graphstorages(disk_based: bool) -> Result<Graph<CT>, Error>[src]

Create a new instance without any location on the disk but with the default graph storage components.

pub fn load_from(&mut self, location: &Path, preload: bool) -> Result<(), Error>[src]

Load the graph from an external location. This sets the location of this instance to the given location.

  • location - The path on the disk
  • preload - If true, all components are loaded from disk into main memory.

pub fn save_to(&mut self, location: &Path) -> Result<(), Error>[src]

Save the current database to a location on the disk, but do not remember this location.

pub fn persist_to(&mut self, location: &Path) -> Result<(), Error>[src]

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<(), Error> where
    F: Fn(&str), 
[src]

Apply a sequence of updates (u parameter) to this graph. If the graph has a location on the disk, the changes are persisted.

pub fn background_sync_wal_updates(&self) -> Result<(), Error>[src]

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<(), Error>
[src]

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, Error>
[src]

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.

pub fn is_loaded(&self, c: &Component<CT>) -> bool[src]

Returns true if the graph storage for this specific component is loaded and ready to use.

pub fn ensure_loaded_all(&mut self) -> Result<(), Error>[src]

Ensure that the graph storages for all component are loaded and ready to use.

pub fn ensure_loaded(&mut self, c: &Component<CT>) -> Result<(), Error>[src]

Ensure that the graph storage for a specific component is loaded and ready to use.

pub fn optimize_impl(&mut self, c: &Component<CT>) -> Result<(), Error>[src]

pub fn get_node_id_from_name(&self, node_name: &str) -> Option<u64>[src]

pub fn get_graphstorage(
    &self,
    c: &Component<CT>
) -> Option<Arc<dyn GraphStorage + 'static>>
[src]

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)>
[src]

Get a read-only graph storage reference for the given component c.

pub fn get_node_annos(&self) -> &dyn AnnotationStorage<u64>[src]

Get a read-only reference to the node annotations of this graph

pub fn get_node_annos_mut(&mut self) -> &mut dyn AnnotationStorage<u64>[src]

Get a mutable reference to the node annotations of this graph

pub fn get_all_components(
    &self,
    ctype: Option<CT>,
    name: Option<&str>
) -> Vec<Component<CT>>
[src]

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.

pub fn size_of_cached(&self, ops: &mut MallocSizeOfOps) -> usize[src]

Trait Implementations

impl<CT> MallocSizeOf for Graph<CT> where
    CT: ComponentType
[src]

Auto Trait Implementations

impl<CT> !RefUnwindSafe for Graph<CT>

impl<CT> Send for Graph<CT>

impl<CT> Sync for Graph<CT>

impl<CT> Unpin for Graph<CT> where
    CT: Unpin

impl<CT> !UnwindSafe for Graph<CT>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,