ttm-rs

Crates.iottm-rs
lib.rsttm-rs
version0.1.0
sourcesrc
created_at2020-02-20 03:58:02.288375
updated_at2020-02-20 03:58:02.288375
descriptionCLI to turn tuples into adjacency matrices
homepagehttps://github.com/nonnontrivial/ttm-rs
repositoryhttps://github.com/nonnontrivial/ttm-rs.git
max_upload_size
id210813
size24,150
Kevin Donahue (nonnontrivial)

documentation

README

ttm-rs

Rust

CLI to turn tuples into adjacency matrices

Status

This is a hobby project in early development.

Tested on cargo 1.42.0-nightly

Features

  • works with same args that unix tsort accepts
  • works with .txt tuple input

Future

  • works with .md, and .json file input
  • works with stdin tuple input
  • better formatting
  • better tuple parsing

Usage

Given a source file containing a directed graph represented as source->target 2-tuples, ttm-rs creates an adjacency matrix where ij is 1 when i has j as a target.

Text file input

For example, digraph.txt

0 3
1 2
2 2
2 3
3 1

Run using newline as tuple delimiter (default)

cargo r -- -f ./digraph.txt

prints to stdout

[[0, 0, 0, 1],
 [0, 0, 1, 0],
 [0, 0, 1, 1],
 [0, 1, 0, 0]]

Install

Cargo

cargo install ttm-rs
Commit count: 0

cargo fmt