#[derive(Debug, PartialEq)]
pub struct Graph {
pub strict: bool,
pub graph_type: Option<GraphType>,
pub id: Option<String>,
pub statements: Vec<Statement>,
}
#[derive(Debug, PartialEq, Clone)]
pub struct SubGraph {
pub id: Option<String>,
pub statements: Vec<Statement>,
}
#[derive(Debug, PartialEq)]
pub enum GraphType {
Graph,
Digraph,
}
#[derive(Debug, PartialEq, Clone)]
pub enum Statement {
EdgeStatement(EdgeStatement),
AttributeStatement(AttributeStatement),
IdPair(IdPair),
Subgraph(SubGraph),
NodeStatement(NodeStatement),
}
#[derive(Debug, PartialEq, Clone)]
pub enum Edge {
NodeId(NodeId),
Subgraph(SubGraph),
}
#[derive(Debug, PartialEq, Clone)]
pub struct EdgeStatement {
pub edge: Edge,
pub edge_rhs_list: Vec<EdgeRhs>,
pub attributes: Option<Vec<Attribute>>,
}
#[derive(Debug, PartialEq, Clone)]
pub struct EdgeRhs {
pub edge_op: EdgeOp,
pub edge: Edge,
}
#[derive(Debug, PartialEq, Clone)]
pub enum EdgeOp {
Arrow,
Line,
}
#[derive(Debug, PartialEq, Clone)]
pub struct AttributeStatement {
pub attribute_type: AttributeType,
pub attributes: Option<Vec<Attribute>>,
}
#[derive(Debug, PartialEq, Clone)]
pub struct NodeStatement {
pub node_id: NodeId,
pub attributes: Option<Vec<Attribute>>,
}
#[derive(Debug, PartialEq, Clone)]
pub enum AttributeType {
Graph,
Node,
Edge,
}
#[derive(Debug, PartialEq, Clone)]
pub struct Attribute {
pub key: String,
pub value: String,
}
pub type IdPair = Attribute;
#[derive(Debug, PartialEq, Clone)]
pub struct NodeId {
pub node_id: String,
pub port: Option<Port>,
}
#[derive(Debug, PartialEq, Clone)]
pub struct Port {
pub port_id: Option<String>,
pub compass: Option<Compass>,
}
#[derive(Debug, PartialEq, Clone)]
pub enum Compass {
N,
NE,
E,
SE,
S,
SW,
W,
NW,
C,
Unknown,
}