dotparser

Crates.iodotparser
lib.rsdotparser
version0.3.0
created_at2025-06-15 16:42:22.829251+00
updated_at2025-06-15 22:01:03.955104+00
descriptiondiagram file parser for Bevy visualization of diagrams
homepage
repositoryhttps://github.com/navicore/dotparser
max_upload_size
id1713446
size71,602
Ed Sweeney (navicore)

documentation

README

dotparser

A Rust library for parsing Graphviz DOT files into graph structures.

Overview

dotparser converts DOT format files into a graph representation using petgraph. It handles both standard edge-based graphs and nested subgraph structures.

Usage

use dotparser::dot;

let dot_content = r#"
    digraph {
        A -> B;
        B -> C;
    }
"#;

let graph_data = dot::parse(dot_content);
println!("Nodes: {}", graph_data.graph.node_count());
println!("Edges: {}", graph_data.graph.edge_count());

Features

  • Parses standard DOT edge notation (A -> B)
  • Supports nested subgraphs
  • Handles node attributes (type, level)
  • Preserves node labels and relationships

Data Structures

The parser outputs a GraphData structure containing:

  • A petgraph::DiGraph with node information
  • A HashMap for node name lookups

Nodes can have types like Organization, Team, User, etc., useful for hierarchical visualizations.

Future

This crate currently supports DOT format only. Other diagram formats may be added as separate modules.

License

MIT

Commit count: 6

cargo fmt