Trait graphannis::graph::GraphStorage

source ·
pub trait GraphStorage: EdgeContainer {
    // Required methods
    fn find_connected<'a>(
        &'a self,
        node: u64,
        min_distance: usize,
        max_distance: Bound<usize>
    ) -> Box<dyn Iterator<Item = Result<u64, GraphAnnisCoreError>> + 'a>;
    fn find_connected_inverse<'a>(
        &'a self,
        node: u64,
        min_distance: usize,
        max_distance: Bound<usize>
    ) -> Box<dyn Iterator<Item = Result<u64, GraphAnnisCoreError>> + 'a>;
    fn distance(
        &self,
        source: u64,
        target: u64
    ) -> Result<Option<usize>, GraphAnnisCoreError>;
    fn is_connected(
        &self,
        source: u64,
        target: u64,
        min_distance: usize,
        max_distance: Bound<usize>
    ) -> Result<bool, GraphAnnisCoreError>;
    fn get_anno_storage(&self) -> &dyn EdgeAnnotationStorage;
    fn copy(
        &mut self,
        node_annos: &dyn NodeAnnotationStorage,
        orig: &dyn GraphStorage
    ) -> Result<(), GraphAnnisCoreError>;
    fn as_edgecontainer(&self) -> &dyn EdgeContainer;
    fn serialization_id(&self) -> String;
    fn load_from(location: &Path) -> Result<Self, GraphAnnisCoreError>
       where Self: Sized;
    fn save_to(&self, location: &Path) -> Result<(), GraphAnnisCoreError>;

    // Provided methods
    fn as_writeable(&mut self) -> Option<&mut dyn WriteableGraphStorage> { ... }
    fn inverse_has_same_cost(&self) -> bool { ... }
}
Expand description

A graph storage is the representation of an edge component of a graph with specific structures. These specific structures are exploited to efficiently implement reachability queries.

Required Methods§

source

fn find_connected<'a>( &'a self, node: u64, min_distance: usize, max_distance: Bound<usize> ) -> Box<dyn Iterator<Item = Result<u64, GraphAnnisCoreError>> + 'a>

Find all nodes reachable from a given start node inside the component.

source

fn find_connected_inverse<'a>( &'a self, node: u64, min_distance: usize, max_distance: Bound<usize> ) -> Box<dyn Iterator<Item = Result<u64, GraphAnnisCoreError>> + 'a>

Find all nodes reachable from a given start node inside the component, when the directed edges are inversed.

source

fn distance( &self, source: u64, target: u64 ) -> Result<Option<usize>, GraphAnnisCoreError>

Compute the distance (shortest path length) of two nodes inside this component.

source

fn is_connected( &self, source: u64, target: u64, min_distance: usize, max_distance: Bound<usize> ) -> Result<bool, GraphAnnisCoreError>

Check if two nodes are connected with any path in this component given a minimum (min_distance) and maximum (max_distance) path length.

source

fn get_anno_storage(&self) -> &dyn EdgeAnnotationStorage

Get the annotation storage for the edges of this graph storage.

source

fn copy( &mut self, node_annos: &dyn NodeAnnotationStorage, orig: &dyn GraphStorage ) -> Result<(), GraphAnnisCoreError>

Copy the content of another component. This removes the existing content of this graph storage.

source

fn as_edgecontainer(&self) -> &dyn EdgeContainer

Upcast this graph storage to the EdgeContainer trait.

source

fn serialization_id(&self) -> String

Return an identifier for this graph storage which is used to distinguish the different graph storages when (de-) serialized.

source

fn load_from(location: &Path) -> Result<Self, GraphAnnisCoreError>
where Self: Sized,

Load the graph storage from a location on the disk. This location is a directory, which can contain files specific to this graph storage.

source

fn save_to(&self, location: &Path) -> Result<(), GraphAnnisCoreError>

Save the graph storage a location on the disk. This location must point to an existing directory.

Provided Methods§

source

fn as_writeable(&mut self) -> Option<&mut dyn WriteableGraphStorage>

Try to downcast this graph storage to a WriteableGraphStorage trait. Returns None if this graph storage is not writable.

source

fn inverse_has_same_cost(&self) -> bool

If true, finding the inverse connected nodes via find_connected_inverse(…) has the same cost as the non-inverse case.

Implementors§

source§

impl GraphStorage for AdjacencyListStorage

source§

impl GraphStorage for DenseAdjacencyListStorage

source§

impl GraphStorage for DiskAdjacencyListStorage

source§

impl GraphStorage for DiskPathStorage

source§

impl<OrderT, LevelT> GraphStorage for PrePostOrderStorage<OrderT, LevelT>
where OrderT: 'static + for<'de> NumValue + for<'de> Deserialize<'de> + for<'de> Serialize, LevelT: 'static + for<'de> NumValue + for<'de> Deserialize<'de> + for<'de> Serialize,

source§

impl<PosT> GraphStorage for LinearGraphStorage<PosT>
where PosT: 'static + for<'de> NumValue + for<'de> Deserialize<'de> + for<'de> Serialize,