Giter VIP home page Giter VIP logo

kurve's Introduction

Kurve

Simple adjacency list Graph data structure with Dijkstra pathing.

No bells, no whistles; just a graph with the ability to add / remove vertices with weighted / unweighted edges with a simple pathing algorithm.

Performance? Not designed with that in mind but good enough for simple - intermediate cases.

Usage

use kurve::Kurve;

// Create a graph with String IDs and i32 values
let mut graph: Kurve<String, i32> = Kurve::new();

// Add some vertices
graph.add_vertex("id_1".to_string(), 100);
graph.add_vertex("id_2".to_string(), 200);
graph.add_vertex("id_3".to_string(), 300);
graph.add_vertex("id_4".to_string(), 400);

// Add some edges
graph.add_edge("id_1".to_string(), "id_2".to_string());
graph.add_edge("id_1".to_string(), "id_3".to_string());
graph.add_edge("id_2".to_string(), "id_4".to_string());
graph.add_edge("id_4".to_string(), "id_3".to_string());

// Get neighbors of a node
let neighbors = graph.get_neighbors("id_1".to_string()); // ["id_2", "id_3"]

// Find paths
let path = graph.dijkstra("id_1".to_string(), "id_4".to_string()); // ["id_1", "id_2", "id_4"]

kurve's People

Contributors

tyrannican avatar

Stargazers

Ryuta Suzuki avatar

Watchers

 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.