Due to organizational changes, the Graphviz web site will see some modifications in the near future. In particular, it will probably no longer provide binary packages for Windows and Macs. The latter can be obtained via Macports or Home Brew. If someone wants to set up Appveyor for Windows, we would be grateful. |

# 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

Many thanks for your help.

## Recent comments

- This is a bug that has been

12 weeks 2 hours ago - Double edges: even with latest version

12 weeks 3 hours ago - If you run dot.exe -V, this

21 weeks 4 days ago - Not sure

21 weeks 4 days ago - What version of Graphviz are

21 weeks 5 days ago - update

47 weeks 2 days ago - re: yum install - Error downloading packages

1 year 3 weeks ago - yum install - Error downloading packages

1 year 3 weeks ago - Hi,
Sorry, I was a little

1 year 4 weeks ago - The difficulties you are

1 year 9 weeks ago

## 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