Steven Lu
Steven Lu

Reputation: 43427

dot (graphviz): What is "type=s"?

I see this in examples all the time (like the ethane molecule one) and it is never explained.

What is [type=s]? what are the different types?

Upvotes: 3

Views: 415

Answers (1)

user1201210
user1201210

Reputation: 3809

I see this in examples all the time (like the ethane molecule one) ...

I assume you're referring to the ethane molecule example on Wikipedia's DOT language page:

 graph ethane {
     C_0 -- H_0 [type=s];
     C_0 -- H_1 [type=s];
     C_0 -- H_2 [type=s];
     C_0 -- C_1 [type=s];
     C_1 -- H_3 [type=s];
     C_1 -- H_4 [type=s];
     C_1 -- H_5 [type=s];
 }

A few things of interest:

  • The use of attribute type on the Wikipedia page dates back to 2004 and is in the first version of the page, almost identical to the version there today.

  • There is no attribute type listed in the current graphviz documentation.

  • I installed graphviz 1.14 and its DOT documentation (circa 2002) does not list type as an attribute.

  • I found DOT documentation for graphviz 1.7, dated 1996. It doesn't list attribute type either.

  • Removing the type attributes from the graph or changing their values does not affect the output for the current version of graphviz or version 1.14.

Various attributes have changed over time, and it's possible that type is the old name of something like tailPort, which accepts a portPos for input to indicate which side of a node to attach the edge ("s" for "south", "n" for "north", etc). Maybe it was used in a version that I don't have the documentation for. Or maybe it was never used at all, and people just faithfully copied it from Wikipedia. ;)

Upvotes: 4

Related Questions