pub struct Graph {
pub project: Option<ProjectMeta>,
pub nodes: Vec<Node>,
pub edges: Vec<Edge>,
}Expand description
A complete GID graph with nodes and edges.
Fields§
§project: Option<ProjectMeta>§nodes: Vec<Node>§edges: Vec<Edge>Implementations§
Source§impl Graph
impl Graph
pub fn new() -> Self
pub fn get_node(&self, id: &str) -> Option<&Node>
pub fn get_node_mut(&mut self, id: &str) -> Option<&mut Node>
pub fn add_node(&mut self, node: Node)
pub fn remove_node(&mut self, id: &str) -> Option<Node>
pub fn update_status(&mut self, id: &str, status: NodeStatus) -> bool
pub fn add_edge(&mut self, edge: Edge)
pub fn remove_edge(&mut self, from: &str, to: &str, relation: Option<&str>)
pub fn edges_from(&self, id: &str) -> Vec<&Edge>
pub fn edges_to(&self, id: &str) -> Vec<&Edge>
Sourcepub fn ready_tasks(&self) -> Vec<&Node>
pub fn ready_tasks(&self) -> Vec<&Node>
Get tasks that are ready (todo + all depends_on are done).
Sourcepub fn tasks_by_status(&self, status: &NodeStatus) -> Vec<&Node>
pub fn tasks_by_status(&self, status: &NodeStatus) -> Vec<&Node>
Get tasks by status.
Sourcepub fn summary(&self) -> GraphSummary
pub fn summary(&self) -> GraphSummary
Summary statistics.
Sourcepub fn summary_text(&self) -> String
pub fn summary_text(&self) -> String
Get a human-readable text summary of the graph state.
Sourcepub fn health(&self) -> f64
pub fn health(&self) -> f64
Calculate graph health score (0.0 to 1.0).
Health is based on:
- Progress: ratio of done tasks to total
- Flow: ratio of ready tasks to remaining (non-blocked) tasks
- Connectivity: graphs with edges are healthier than isolated nodes
Returns 1.0 for a fully complete graph, 0.0 for an empty or stuck graph.
Sourcepub fn mark_task_done(&mut self, node_id: &str) -> bool
pub fn mark_task_done(&mut self, node_id: &str) -> bool
Mark a task as done. Returns true if found and updated.
Sourcepub fn get_executable_tasks(&self) -> Vec<Task>
pub fn get_executable_tasks(&self) -> Vec<Task>
Get executable tasks (alias for ready_tasks, returns owned Task structs).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Graph
impl<'de> Deserialize<'de> for Graph
Source§fn 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
Source§impl KnowledgeGraph for Graph
impl KnowledgeGraph for Graph
Source§fn get_knowledge_mut(&mut self, node_id: &str) -> Option<&mut KnowledgeNode>
fn get_knowledge_mut(&mut self, node_id: &str) -> Option<&mut KnowledgeNode>
Get mutable access to a node’s knowledge storage
Source§fn get_knowledge(&self, node_id: &str) -> Option<&KnowledgeNode>
fn get_knowledge(&self, node_id: &str) -> Option<&KnowledgeNode>
Get read access to a node’s knowledge storage
Source§impl KnowledgeManagement for Graph
impl KnowledgeManagement for Graph
Source§fn store_finding(&mut self, node_id: &str, key: &str, value: &str) -> Result<()>
fn store_finding(&mut self, node_id: &str, key: &str, value: &str) -> Result<()>
Store a finding in a node
Source§fn get_finding(&self, node_id: &str, key: &str) -> Option<String>
fn get_finding(&self, node_id: &str, key: &str) -> Option<String>
Get a finding from a node or any upstream node
Source§fn get_upstream_findings(&self, node_id: &str, key: &str) -> Option<String>
fn get_upstream_findings(&self, node_id: &str, key: &str) -> Option<String>
Get finding from upstream nodes recursively
Source§fn cache_file(&mut self, node_id: &str, path: &str, content: &str) -> Result<()>
fn cache_file(&mut self, node_id: &str, path: &str, content: &str) -> Result<()>
Cache file content in a node
Source§fn get_cached_file(&self, node_id: &str, path: &str) -> Option<String>
fn get_cached_file(&self, node_id: &str, path: &str) -> Option<String>
Get cached file from this node or upstream
Source§fn record_tool_call(
&mut self,
node_id: &str,
tool_name: &str,
summary: &str,
) -> Result<()>
fn record_tool_call( &mut self, node_id: &str, tool_name: &str, summary: &str, ) -> Result<()>
Record a tool call
Source§fn get_tool_history(&self, node_id: &str) -> Vec<ToolCallRecord>
fn get_tool_history(&self, node_id: &str) -> Vec<ToolCallRecord>
Get all tool calls from this and upstream nodes
Source§fn get_knowledge_context(&self, node_id: &str) -> String
fn get_knowledge_context(&self, node_id: &str) -> String
Get all findings from this and upstream nodes as formatted context
Auto Trait Implementations§
impl Freeze for Graph
impl RefUnwindSafe for Graph
impl Send for Graph
impl Sync for Graph
impl Unpin for Graph
impl UnsafeUnpin for Graph
impl UnwindSafe for Graph
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more