[−][src]Trait sophia::graph::indexed::IndexedGraph
A utility trait for implementing Graph
and MutableGraph
based on an internal TermIndexMap
for efficient storage.
The impl_mutable_graph_for_indexed_graph!
macro
can be used to derive the MutableGraph
implementation
for any implementation of IndexedGraph
.
Associated Types
type Index: Copy + Eq + Hash
The type used to represent terms internally.
type TermData: TermData + 'static
Required methods
fn with_capacity(capacity: usize) -> Self
Construct a new empty graph, provisioning for storing capacity
triples.
fn shrink_to_fit(&mut self)
Shrink the memory consumption of the graph as much as possible.
fn get_index<T: ?Sized>(&self, t: &T) -> Option<Self::Index> where
T: TTerm,
T: TTerm,
Return the index for the given term, if it exists.
fn get_term(&self, i: Self::Index) -> Option<&Term<Self::TermData>>
Return the term for the given index, if it exists.
fn insert_indexed<TS: ?Sized, TP: ?Sized, TO: ?Sized>(
&mut self,
s: &TS,
p: &TP,
o: &TO
) -> Option<[Self::Index; 3]> where
TS: TTerm,
TP: TTerm,
TO: TTerm,
&mut self,
s: &TS,
p: &TP,
o: &TO
) -> Option<[Self::Index; 3]> where
TS: TTerm,
TP: TTerm,
TO: TTerm,
Insert a triple in this Graph, and return the corresponding tuple of indices.
fn remove_indexed<TS: ?Sized, TP: ?Sized, TO: ?Sized>(
&mut self,
s: &TS,
p: &TP,
o: &TO
) -> Option<[Self::Index; 3]> where
TS: TTerm,
TP: TTerm,
TO: TTerm,
&mut self,
s: &TS,
p: &TP,
o: &TO
) -> Option<[Self::Index; 3]> where
TS: TTerm,
TP: TTerm,
TO: TTerm,
Remove a triple from this Graph, and return the corresponding tuple of indices.
Implementors
impl<I> IndexedGraph for HashGraph<I> where
I: TermIndexMap,
I::Index: Hash,
<I::Factory as TermFactory>::TermData: 'static,
[src]
I: TermIndexMap,
I::Index: Hash,
<I::Factory as TermFactory>::TermData: 'static,
type Index = I::Index
type TermData = <I::Factory as TermFactory>::TermData
fn with_capacity(capacity: usize) -> Self
[src]
fn shrink_to_fit(&mut self)
[src]
fn get_index<T: ?Sized>(&self, t: &T) -> Option<Self::Index> where
T: TTerm,
[src]
T: TTerm,
fn get_term(&self, i: Self::Index) -> Option<&Term<Self::TermData>>
[src]
fn insert_indexed<TS: ?Sized, TP: ?Sized, TO: ?Sized>(
&mut self,
s: &TS,
p: &TP,
o: &TO
) -> Option<[Self::Index; 3]> where
TS: TTerm,
TP: TTerm,
TO: TTerm,
[src]
&mut self,
s: &TS,
p: &TP,
o: &TO
) -> Option<[Self::Index; 3]> where
TS: TTerm,
TP: TTerm,
TO: TTerm,
fn remove_indexed<TS: ?Sized, TP: ?Sized, TO: ?Sized>(
&mut self,
s: &TS,
p: &TP,
o: &TO
) -> Option<[Self::Index; 3]> where
TS: TTerm,
TP: TTerm,
TO: TTerm,
[src]
&mut self,
s: &TS,
p: &TP,
o: &TO
) -> Option<[Self::Index; 3]> where
TS: TTerm,
TP: TTerm,
TO: TTerm,
impl<T> IndexedGraph for OpsWrapper<T> where
T: IndexedGraph + Graph<Triple = ByTermRefs<Term<<T as IndexedGraph>::TermData>>>,
[src]
T: IndexedGraph + Graph<Triple = ByTermRefs<Term<<T as IndexedGraph>::TermData>>>,
type Index = T::Index
type TermData = T::TermData
fn with_capacity(capacity: usize) -> Self
[src]
fn shrink_to_fit(&mut self)
[src]
fn get_index<U_: ?Sized>(&self, t: &U_) -> Option<Self::Index> where
U_: TTerm,
[src]
U_: TTerm,
fn get_term(&self, i: Self::Index) -> Option<&Term<Self::TermData>>
[src]
fn insert_indexed<TS_: ?Sized, TP_: ?Sized, TO_: ?Sized>(
&mut self,
s: &TS_,
p: &TP_,
o: &TO_
) -> Option<[Self::Index; 3]> where
TS_: TTerm,
TP_: TTerm,
TO_: TTerm,
[src]
&mut self,
s: &TS_,
p: &TP_,
o: &TO_
) -> Option<[Self::Index; 3]> where
TS_: TTerm,
TP_: TTerm,
TO_: TTerm,
fn remove_indexed<TS_: ?Sized, TP_: ?Sized, TO_: ?Sized>(
&mut self,
s: &TS_,
p: &TP_,
o: &TO_
) -> Option<[Self::Index; 3]> where
TS_: TTerm,
TP_: TTerm,
TO_: TTerm,
[src]
&mut self,
s: &TS_,
p: &TP_,
o: &TO_
) -> Option<[Self::Index; 3]> where
TS_: TTerm,
TP_: TTerm,
TO_: TTerm,
impl<T> IndexedGraph for SpoWrapper<T> where
T: IndexedGraph + Graph<Triple = ByTermRefs<Term<<T as IndexedGraph>::TermData>>>,
[src]
T: IndexedGraph + Graph<Triple = ByTermRefs<Term<<T as IndexedGraph>::TermData>>>,
type Index = T::Index
type TermData = T::TermData
fn with_capacity(capacity: usize) -> Self
[src]
fn shrink_to_fit(&mut self)
[src]
fn get_index<U_: ?Sized>(&self, t: &U_) -> Option<Self::Index> where
U_: TTerm,
[src]
U_: TTerm,
fn get_term(&self, i: Self::Index) -> Option<&Term<Self::TermData>>
[src]
fn insert_indexed<TS_: ?Sized, TP_: ?Sized, TO_: ?Sized>(
&mut self,
s: &TS_,
p: &TP_,
o: &TO_
) -> Option<[Self::Index; 3]> where
TS_: TTerm,
TP_: TTerm,
TO_: TTerm,
[src]
&mut self,
s: &TS_,
p: &TP_,
o: &TO_
) -> Option<[Self::Index; 3]> where
TS_: TTerm,
TP_: TTerm,
TO_: TTerm,
fn remove_indexed<TS_: ?Sized, TP_: ?Sized, TO_: ?Sized>(
&mut self,
s: &TS_,
p: &TP_,
o: &TO_
) -> Option<[Self::Index; 3]> where
TS_: TTerm,
TP_: TTerm,
TO_: TTerm,
[src]
&mut self,
s: &TS_,
p: &TP_,
o: &TO_
) -> Option<[Self::Index; 3]> where
TS_: TTerm,
TP_: TTerm,
TO_: TTerm,