Trait GraphStorage

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

    // 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: NodeID, min_distance: usize, max_distance: Bound<usize>, ) -> Box<dyn Iterator<Item = Result<NodeID>> + 'a>

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

Source

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

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

Source

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

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

Source

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

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<()>

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>
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<()>

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 for<'de> OrderT: NumValue + Deserialize<'de> + Serialize + 'static, for<'de> LevelT: NumValue + Deserialize<'de> + Serialize + 'static,

Source§

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