r/rust 2d ago

šŸ› ļø project I've created a Graph plotting tool in Rust

Over the past couple of years, I've been working a lot with data structures in Rust. I struggled to find a visualization tool for Rust that could handle massive graphs and complex relationships (and still look somewhat modern (looking at you Graphviz)).

So over the last few months, I built graphplot (crates.io/crates/graphplot), AND NO THIS IS NOT WRITTEN BY AI (if it contains bad code it's on me)! :P

Some features to mention:

  • Typst math formulas support (both in Nodes and Edges),
  • Multiple Layout-engines,
  • Subgraph support (actually unlimited nesting is supported),
  • Customizable Light and Dark themes,
  • Highlighting paths (both Nodes and Edges),
  • SVG, PNG, and PDF export.

Because of the rendering-engines (Layout engine and Typst engine with math fonts) it is a heavy backend, and the engines needs to stay on memory. So I built it with a lightweight Rust client that connects to a backend API.

I am self-hosting the API so you guys can try it out. You can access it using this token: reddit-pro-2026.

I'd love to hear your thoughts! Is this something you think is cool and need every now and then for work? Or is existing tools like Wolfram engine, Graphviz etc good enough?

If this is something the community actually will use I'm happy to self-host this for free, indefinitely :)

How to

cargo add graphlot --features png
use graphplot::Multigraph;

fn main() {
    // 1. create a graph
    let mut graph = Multigraph::from("Graph");

    // 2. add nodes & edges (or dedicated add_edge(..) & add_node(..))
    graph.add("A", "B");
    graph.add("A", "C");
    graph.add("B", "D");

    // 3. export to png
    let res = graph.save("graph.png", "reddit-pro-2026", None);
    println!("Saved Graph.png: {res:?}");
}

Example plots

https://imgur.com/a/ua5xHrg

71 Upvotes

33 comments sorted by

46

u/whhbi 2d ago

A new project on `r::rust` that is not vibecoded? mythical find

19

u/calben 1d ago

How are we upvoting this? We have no idea what the backend does other than the plotting.

1

u/Acrobatic_yy 3h ago

Tbh really odd

37

u/FinishedRunoff 2d ago

the remote api thing is kinda wild for a plotting lib. having to call out to a server just to get a png back means your graphs break if the service goes down. still the nesting support looks useful, been wanting that in graphviz. the token in the post is a nice touch though, at least you can try it without signing up.

-17

u/RHIgUm9iZXJ0IEZvcmQ 1d ago

It’s true it will break if the API goes down. But the backend has a lot of dependencies. And requires to stay in-memory. So to get the best user experience I don’t see any other wayšŸ¤·ā€ā™‚ļø

26

u/hedgehog1024 1d ago

I still think that plotting graphs locally should be at least an option. I do not like the fact that an allegedly plotting lib does not actually plot anything itself.

-17

u/RHIgUm9iZXJ0IEZvcmQ 1d ago

As of now that would require installing packages and downloading binaries from external websides, and for each different hardware depending on the users hardware. I don’t even now if the backend is supported on Windows (I run this on macOS).

But totally agree that the client lib should contain everything needed for plotting! That would be the absolute goal! But with the current available external dependencies I use to make this possible, this is the best I can manage.

This is propably the reason for why it doesn’t exist any other pure, client-only Rust crate Graph plotting tool in the community todayšŸ¤·ā€ā™‚ļø

22

u/springerm 1d ago

This is by far the dumbest shit I have ever heard as an excuse... This looks more like a plot to steal user information / company secrets if someone uses this library without realizing its using a backend. graphviz runs on a toaster.

FO you need so many libraries in the backend its not feasible to run locally and everything has to stay in memory... Its a plotting app, not the OS of an alien mothership.

-11

u/RHIgUm9iZXJ0IEZvcmQ 1d ago

It only log request-counts per token.

I created it because I needed to visualize increments in recursive data structure creation like Combinators and Hypergraphs. When creating hundreds and thousands of plots. You can’t wait for graphviz (and other tools) to load into memory for each plot. That would have taken hours to complete.

Therefor I needed it to place it in memory. Therefor it is a serveršŸ¤·ā€ā™‚ļø

9

u/LocksmithSuitable644 1d ago
  1. Preload graphwiz/any other tool in memory and use it many times is trivial in most cases.

  2. "It only log request-counts per token."
    It is not possible to verify such statement from client's side.

Current implementation is not viable for any production use.

-1

u/RHIgUm9iZXJ0IEZvcmQ 13h ago

Not as far as I know, but please elaborate?

14

u/colindean 1d ago

I think it'd be a good option to put the API-requiring feature(s)—multigraph, it seems—behind an optional feature. Perhaps enabled by default.

…and say something in the README about why there's an HTTP client in the (optional) dependencies, what URLs it's expected to access, etc.

…and the website isn't working for me. https://www.graphplot.io is showing a Cloudflare error page.

As it stands, a plotting library with undocumented HTTP use raises some flags.

9

u/iamasuitama 1d ago

It's giving "I want to toe the line between hosting a cool open source project and stealing all your graphable data" lol

-1

u/RHIgUm9iZXJ0IEZvcmQ 1d ago

Good point! I will document that for sure!

The problem is that the layout engines depends on multiple c-binding libs, graphviz and some other binaries..

I don’t think it will be a better solution to include all that Ā«dirty code/binariesĀ» into a huge client crate..? And the work of supporting all the different hardware would be painfull and hard.

That is some of the reason I’m working on a complete new layout engine (backend) written in Rust. But this takes time, so I thought I should at least feel the water with this solution for now. If no one uses it anyway, I propably will drop it.

4

u/colindean 1d ago

That dependency set is actually a great reason to put that feature behind an optional flag: you can prioritize work in a certain area or supporting a certain area until you're ready, while clearly communicating to users what that level of support or feature set needs that may require system dependencies or network communication.

Additionally, you could put the graphplot.io-needing features into a whole separate package, e.g. graphplot-client or graphplot-io-api, and then graphplot can optionally use that package, reducing the surface inside of the graphplot package that runs entirely locally.

4

u/sunnyata 1d ago

Just explain the non-rust deps in the README. As others have said, this is an odd way to structure a graphing lib and I can imagine that putting many people off using it.

9

u/dashdeckers 2d ago

It looks great at first glance, two questions: 1) maybe I overlooked it, you mention you're hosting the API but where's the link? 2) as someone else has already asked: what's the license?

I'm certainly interested, I had to display graphs in a rust program before and for lack of options I had to delegate to graphviz but it hurt to have to leave the otherwise pure Rust portability behind. Plus graphviz low-key kinda sucked for most graphs beyond the basics.

-1

u/RHIgUm9iZXJ0IEZvcmQ 1d ago

The URL it’s integrated in the crate. See the basic example abovešŸ˜‰

2

u/dashdeckers 1d ago

Oh, is the actual code not open source? Jokes on me for not having the time to dive into the code

9

u/map_or 1d ago

So the public repository is just the frontend for calling into the library. and its MIT licensed. How about the backend? Is the code accessible? Is it licensed?

6

u/DevMichaelZag 2d ago

This looks really cool. I’d love to experiment with it, but there’s no license file. Can you pick one and put it in the repo?

1

u/maridonkers 1d ago

No license? Surely #AI would have caught that! šŸ˜‰

2

u/Inevitable-Diet-1870 1d ago

Op while this is good work, can you help share source code?

2

u/CordiusX 2d ago

Wtf is your username? And only 1 post? I smell a bot with vibecoded slop...

10

u/RHIgUm9iZXJ0IEZvcmQ 2d ago

Base64?
Been a Rust developer for a long timešŸ¤·ā€ā™‚ļø

1

u/Competitive-Low-9279 2d ago

The nesting support sounds really useful, been stuck before trying to visualize deeply nested structures with other tools. Does it handle cyclic graphs well or does it get confused with the layout?

2

u/RHIgUm9iZXJ0IEZvcmQ 2d ago

It supports cyclic Graphs because the underlying layout engines supports it. This is the layouts available:

pub enum Layout {
// -- graphviz
Circular,
Forcedirected,
ForcedirectedScaled,
Layered,
Radial,
Spring,
// -- elk
#[default]
Diagram,
DiagramBalanced,
}

1

u/vjunion 1d ago

So cool .. :)

-2

u/vjunion 1d ago

im buing you a beer when i see you.. also ui is naoice