sodium logo

A fast library for graph/network manipulation inspired by networkx.

Build Status

Installation

Add this to your application's shard.yml:

dependencies:
  sodium:
    github: EddyShure/sodium

Usage

require "sodium"

You can create a graph with nodes of any type. For example, if you want to create a graph with nodes of the type Int32:

graph = Sodium::Graph(Int32).new()

Manipulating the graph is straightforward:

# Add individual nodes
graph.add_node(1)
graph.add_node(2)
graph.add_node(3, {weight: 232})

# Add multiple nodes
graph.add_nodes_from([31, 32, 33])

# Add an edge
graph.add_edge(1, 2)
graph.add_edge(66, 88)

# Add multiple edge
graph.add_edges_from([{2, 3}, {4, 5}, {6, 7}])

# Remove a node
graph.remove_node(1)

For more information, please check out the documentation.

Roadmap

Graph types

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors