add README

This commit is contained in:
filifa 2025-05-10 00:07:48 -04:00
parent df30e34590
commit d8c1296dec
1 changed files with 25 additions and 0 deletions

25
README.md Normal file
View File

@ -0,0 +1,25 @@
# gv2adj
gv2adj computes adjacency matrices (either weighted or unweighted) for Graphviz
graphs (both directed and undirected).
## Usage
To get the adjacency matrix of a graph in `graph.gv`:
```
gv2adj -f graph.gv
```
To get the matrix, but using the values stored in the `len` attribute as edge weights:
```
gv2adj -f graph.gv --weight-attr len
```
Say the nodes in the graph are named `foo`, `bar`, and `baz`. To order the rows and columns of the matrix so they correspond to `bar`, `baz`, `foo`:
```
gv2adj -f graph.gv --order bar,baz,foo
```
## Quirks
* If the `--weight-attr` flag is supplied, but an edge does not have the given
attribute, NaN will be output for that edge.
* If there are multiple edges going from node `a` to node `b`, the matrix entry
will be the sum of the two.