[][src]Crate gsgdt

Generic Stringly typed Graph DataType

Create graphs which have a list of strings as nodes and compute the diff between them.

Use match_graphs to get the mapping (isomorphism) between the nodes.

Use visualize_diff to get a MultiGraph which can then be converted into dot using the to_dot method. The dot file generated can be rendered to various formats using graphviz.

use gsgdt::*;

let label1: String = "bb0__0_3".into();
let label2: String = "bb0__1_3".into();
let style: NodeStyle = Default::default();

let nodes = vec![
    Node::from_list(
        vec!["_1 = const 1_i32".into(), "_2 = const 2_i32".into()],
        label1.clone(),
        "0".into(),
        style.clone(),
    ),
    Node::from_list(
        vec!["return".into()],
        label2.clone(),
        "1".into(),
        style.clone(),
    ),
];

let g = Graph::new(
    "Mir_0_3".into(),
    nodes,
    vec![Edge::new(label1, label2, "return".into())],
);

Structs

DiffGraph

A wrapper around Graph to assist diffing.

Edge

A directed graph edge

EdgeStyle

EdgeStyle defines some style of Edge

Graph

Graph represents a directed graph as a list of nodes and list of edges.

GraphvizSettings
Matching

A Match from a node in the first graph to the second.

MultiGraph

A collection of graphs.

Node

A graph node

NodeStyle

NodeStyle defines some style of Node

Enums

GraphKind
Match

Enum describing the type of a match.

Functions

match_graphs

Matches both graphs and returns the mapping of nodes from g1 to g2.

visualize_diff

Returns a MultiGraph containing the diff of the two graphs. To be visualized with dot.

Type Definitions

AdjList
Mapping