code_repo_wiki/model/
mod.rs1pub mod node;
2pub mod edge;
3pub mod document;
4
5pub use node::*;
6pub use edge::*;
7pub use document::*;
8
9use petgraph::stable_graph::StableDiGraph;
10use serde::{Deserialize, Serialize};
11
12#[derive(Debug, Clone, Serialize, Deserialize)]
14pub struct KnowledgeGraph {
15 pub graph: StableDiGraph<CodeNode, CodeEdge>,
16 pub modules: Vec<ModuleCluster>,
18 #[serde(default)]
20 pub features: Vec<Feature>,
21}
22
23#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
25pub struct ModuleCluster {
26 pub name: String,
27 pub node_ids: Vec<NodeId>,
28 pub cohesion: f64,
29 pub coupling: f64,
30 pub description: Option<String>,
31}
32
33#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
35pub struct Feature {
36 pub name: String,
38 pub node_ids: Vec<NodeId>,
40 pub description: Option<String>,
42}
43
44impl Default for KnowledgeGraph {
45 fn default() -> Self {
46 Self {
47 graph: StableDiGraph::new(),
48 modules: Vec::new(),
49 features: Vec::new(),
50 }
51 }
52}