# how to render output of nodes and edges as table/matrices using GraphViz?

I'm newbie with GraphViz, and I'm curious if it's possible to render Stanford NLP lexparser's output of nodes and edges as as a table/matrices using GraphViz?
There is no edges weights, and I'm also looking how to compute them. Simple chunk of this output is as follows:

(ROOT (S (NP (DT The) (NNP Divine)) (VP (VB Madman) (NP (NP (DT The) (JJ Sublime) (NNP Life) (CC and) (NNP Songs)) (PP (IN of) (NP (NNP Drukpa) (NNP Kunley))))) (. .)))
(ROOT (NP (NP (NNP Translated)) (PP (IN by) (NP (NNP KEITH) (NNP DOWMAN) (CC AND) (NNP SONAM) (NNP PALJOR))) (. .)))
(ROOT (S (NP (DT This) (NN volume)) (VP (VBZ records) (NP (NP (DT some)) (PP (IN of) (NP (NP (DT the) (NNS stories)) (PP (IN about) (NP (NP (DT the) (NNP Adept) (NNP Drukpa) (NNP Kunley)) (, ,) (SBAR (WHNP (WDT which)) (S (PP (TO to) (NP (DT this) (NN day))) (VP (VBP are) (NP (NP (NNS favorites)) (PP (IN of) (NP (NP (DT the) (NNS people)) (PP (IN of) (NP (NP (NNP Tibet)) (CC and) (NP (DT the) (VBG surrounding) (NNS regions)))))))))))))))) (. .)))

need to convert it to the matrices like:

edges:
1 2 1
1 3 1
1 4 1
1 5 1
1 6 1
1 7 1
1 8 1
1 9 1
1 10 1
1 11 1
2 1 1
2 3 1
2 4 1
2 5 1
2 6 1
2 7 1
2 8 1
2 9 1
2 10 1
2 12 1
3 1 1
3 2 1
3 4 1
3 5 1
3 6 1
3 7 1
3 8 1
3 9 1
3 10 1
3 13 1
4 1 1
4 2 1
4 3 1
4 5 1
4 6 1
4 7 1
4 8 1
4 9 1
4 10 1
4 14 1
5 1 1
5 2 1
5 3 1
5 4 1
5 6 1
5 7 1
5 8 1
5 9 1
5 10 1
5 15 1
6 1 1

nodes:
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16

### Re: how to render output of nodes and edges as table/matrices

It's not clear this problem can be helped by Graphviz.

However, the Stanford NLP system has a function toDotFormat() that generates networks in Graphviz format. Then you could run a script in Graphviz gvpr to convert the graph to a matrix, for example,

BEGIN {int nodeseq; }
BEG_G { \$tvtype = "TV_ne"; nodeseq = 1; }
N { \$.seq = nodeseq++; }
E {printf("%d %d 1\n",\$.tail.seq, \$.head.seq); }

TV_ne just says to perform the traversal in the order of all nodes, then all edges.  The rest just defines sequence numbers on the nodes and then prints the edges using those numbers.

Stephen North