gv2adj/README.md

796 B

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.