Coder Social home page Coder Social logo

cowboyai / fdg Goto Github PK

View Code? Open in Web Editor NEW

This project forked from grantshandy/fdg

0.0 0.0 0.0 119.94 MB

A Force Directed Graph Framework for Rust.

Home Page: https://grantshandy.github.io/fdg

License: MIT License

Shell 0.50% JavaScript 2.76% Rust 82.42% CSS 0.17% Makefile 0.19% HTML 7.01% Vue 6.94%

fdg's Introduction

fdg

A (force-directed) graph drawing library for Rust. Convert any petgraph::Graph into a pretty picture!

screenshot

The goal of this library is to create some idiomatic building blocks for writing fast graph drawing algorithms in Rust. I hope to implement more algorithms such as ForceAtlas2 (2014) and Kamada-Kawai (1989). I also want to experiment with generating the layouts with SIMD, parallelization, and GPU compute.

The library is currently undergoing a complete rewrite with more performant algorithms and a more generic API (now supports computing in N dimensions ๐Ÿ˜‰). The pre 1.0 version is now located in the old branch.

Contributions always welcome!

Usage

use fdg::{fruchterman_reingold::FruchtermanReingold, Force, ForceGraph};

// your dataset: Into<StableGraph<(), ()>>

// Initialize a ForceGraph in 2 dimentions with random node positions from -10.0..=10.0.
let mut graph: ForceGraph<f32, 2, (), ()> = fdg::init_force_graph_uniform(dataset, 10.0);

// Apply the Fruchterman-Reingold (1991) force-directed drawing algorithm 100 times.
FruchtermanReingold::default().apply_many(&mut graph, 100);
// Center the graph's average around (0,0).
Center::default().apply(&mut graph);

// Render nodes:
println!("nodes:");
for (_, pos) in graph.node_weights() {
    println!("{pos:?}");
}

// Render edges:
println!("edges:");
for edge_idx in graph.edge_indices() {
    let (source_idx, target_idx) = graph.edge_endpoints(edge_idx).unwrap();

    println!("{edge_idx:?}: {:?} to {:?}", &graph[source_idx].1, &graph[target_idx].1);
}

See basic.rs...

fdg's People

Contributors

grantshandy avatar asuradev99 avatar wainwrightmark avatar aox0 avatar grafoo avatar quentinledilavrec avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.