Struct ratio_graph::Graph
source · [−]pub struct Graph {
pub id: Uuid,
pub name: String,
pub kind: String,
pub labels: Vec<String>,
pub weights: HashMap<String, f64>,
pub annotations: HashMap<String, String>,
pub nodes: HashMap<Uuid, Node>,
pub edges: HashMap<Uuid, Edge>,
/* private fields */
}Fields
id: UuidUnique instance ID.
name: StringInstance name.
kind: StringMain category of this instance.
labels: Vec<String>Instance labels.
weights: HashMap<String, f64>Numeric instance weights.
annotations: HashMap<String, String>Miscellaneous data fields for this instance.
nodes: HashMap<Uuid, Node>Nodes by their IDs.
edges: HashMap<Uuid, Edge>Edges by their IDs.
Implementations
sourceimpl Graph
impl Graph
sourcepub fn new(
id: Option<Uuid>,
name: Option<String>,
kind: Option<String>,
labels: Option<Vec<String>>,
weights: Option<HashMap<String, f64>>,
annotations: Option<HashMap<String, String>>,
nodes: Option<Vec<Node>>,
edges: Option<Vec<Edge>>
) -> Self
pub fn new(
id: Option<Uuid>,
name: Option<String>,
kind: Option<String>,
labels: Option<Vec<String>>,
weights: Option<HashMap<String, f64>>,
annotations: Option<HashMap<String, String>>,
nodes: Option<Vec<Node>>,
edges: Option<Vec<Edge>>
) -> Self
Create a new graph instance with arguments.
sourcepub fn update_edges_forward(&mut self)
pub fn update_edges_forward(&mut self)
Update the forward edge map..
sourcepub fn update_edges_reverse(&mut self)
pub fn update_edges_reverse(&mut self)
Update the reverse edge map..
sourcepub fn update_edge_maps(&mut self)
pub fn update_edge_maps(&mut self)
Update edge maps.
sourcepub fn check_node(&self, id: &Uuid)
pub fn check_node(&self, id: &Uuid)
Check whether a node’s references exist.
sourcepub fn set_parent(&mut self, child_id: &Uuid, parent_id: Option<&Uuid>)
pub fn set_parent(&mut self, child_id: &Uuid, parent_id: Option<&Uuid>)
Set parent value for a node.
sourcepub fn set_bus(&mut self, child_id: &Uuid, is_bus: bool)
pub fn set_bus(&mut self, child_id: &Uuid, is_bus: bool)
Set the is_bus value of a node. Will only ever be set to true is it has a parent
node to be a bus for.
sourcepub fn check_edge(&self, id: &Uuid)
pub fn check_edge(&self, id: &Uuid)
Check whether an edge’s references exist.
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Graph
impl<'de> Deserialize<'de> for Graph
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for Graph
impl Send for Graph
impl Sync for Graph
impl Unpin for Graph
impl UnwindSafe for Graph
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct self from the equivalent element of its
superset. Read more
fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if self is actually part of its subset T (and can be converted to it).
fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset but without any property checks. Always succeeds.
fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts self to the equivalent element of its superset.