add graph printing

This commit is contained in:
Alwin Berger 2023-09-25 12:14:23 +02:00
parent 4e18b8fdab
commit 3fcb9a74e0

View File

@ -110,6 +110,15 @@ impl SysGraphNode {
pub fn get_input_counts(&self) -> Vec<u32> {
self.variants.iter().map(|x| x.input_counter).collect()
}
pub fn pretty_print(&self) -> String {
let mut ret = String::new();
ret.push_str(&format!("{}#{}",&self.base.current_task.0.task_name,&self.base.current_task.1));
ret.push_str("\nRl:");
for i in &self.base.delay_list_after {
ret.push_str(&format!("\n{}#{}",i.0.task_name,i.1));
}
ret
}
}
impl PartialEq for SysGraphNode {
fn eq(&self, other: &SysGraphNode) -> bool {
@ -156,7 +165,7 @@ pub type GraphMaximizerCorpusScheduler<CS> =
//============================= Graph Feedback
/// Improved System State Graph
#[derive(Serialize, Deserialize, Clone, Debug, Default, SerdeAny)]
#[derive(Serialize, Deserialize, Clone, Debug, SerdeAny)]
pub struct SysGraphFeedbackState
{
pub graph: DiGraph<SysGraphNode, ()>,
@ -233,6 +242,11 @@ impl Named for SysGraphFeedbackState
&self.name
}
}
impl Default for SysGraphFeedbackState {
fn default() -> Self {
Self::new()
}
}
impl SysGraphFeedbackState
{
fn reset(&mut self) -> Result<(), Error> {