[][src]Trait zamm_yin::graph::Graph

pub trait Graph {
    pub fn size(&self) -> usize;
pub fn add_node(&mut self) -> usize;
pub fn set_node_name(&mut self, id: usize, name: &str);
pub fn set_node_value(&mut self, id: usize, value: Rc<dyn KBValue>);
pub fn node_name(&self, id: usize) -> Option<Rc<str>>;
pub fn node_value(&self, id: usize) -> Option<Rc<dyn KBValue>>;
pub fn lookup(&self, name: &str) -> Vec<usize>;
pub fn add_flag(&mut self, id: usize, flag: usize);
pub fn has_flag(&self, id: usize, flag: usize) -> bool;
pub fn add_edge(&mut self, from: usize, edge_type: usize, to: usize);
pub fn has_edge(&self, from: usize, edge_type: usize, to: usize) -> bool;
pub fn outgoing_nodes(&self, from: usize, edge_type: usize) -> Vec<usize>;
pub fn incoming_nodes(&self, to: usize, edge_type: usize) -> Vec<usize>;
pub fn all_outgoing_nodes(&self, from: usize) -> Vec<usize>;
pub fn all_incoming_nodes(&self, to: usize) -> Vec<usize>;
pub fn into_dot(&self) -> String; }

A classic directed Graph with nodes and labeled links.

Required methods

pub fn size(&self) -> usize[src]

The number of nodes in the graph.

pub fn add_node(&mut self) -> usize[src]

Adds a new node to the graph, and returns the node's ID.

pub fn set_node_name(&mut self, id: usize, name: &str)[src]

Sets the name for a given node. Names can only be set once.

pub fn set_node_value(&mut self, id: usize, value: Rc<dyn KBValue>)[src]

Sets the value for a given node. Values can only be set once.

pub fn node_name(&self, id: usize) -> Option<Rc<str>>[src]

Retrieve's a node's name from the graph, or None if the node does not exist or is unnamed.

pub fn node_value(&self, id: usize) -> Option<Rc<dyn KBValue>>[src]

Retrieve's a node's name from the graph, or None if the node does not exist or does not have a value.

pub fn lookup(&self, name: &str) -> Vec<usize>[src]

Look up a node ID based on name. A vec is returned because there are no constraints on name uniqueness.

pub fn add_flag(&mut self, id: usize, flag: usize)[src]

Add a flag to a node. The flag should be the ID of an existing node.

pub fn has_flag(&self, id: usize, flag: usize) -> bool[src]

Return true if this node has the flag set, false otherwise.

pub fn add_edge(&mut self, from: usize, edge_type: usize, to: usize)[src]

Add a labeled edge between two nodes. The label should be the ID of an existing node.

pub fn has_edge(&self, from: usize, edge_type: usize, to: usize) -> bool[src]

Checks for a labeled edge between two nodes. The label should be the ID of an existing node.

pub fn outgoing_nodes(&self, from: usize, edge_type: usize) -> Vec<usize>[src]

Retrieve all node IDs that are on the other end of an outgoing edge of the given type.

pub fn incoming_nodes(&self, to: usize, edge_type: usize) -> Vec<usize>[src]

Retrieve all node IDs that are on the other end of an incoming edge of the given type.

pub fn all_outgoing_nodes(&self, from: usize) -> Vec<usize>[src]

Retrieve all node IDs that are on the other end of outgoing edges.

pub fn all_incoming_nodes(&self, to: usize) -> Vec<usize>[src]

Retrieve all node IDs that are on the other end of incoming edges.

pub fn into_dot(&self) -> String[src]

Outputs the entire graph in DOT format.

Loading content...

Implementors

impl Graph for InjectionGraph[src]

Loading content...