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