Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Graphviz Dot, mix directed and undirected

For my application I need to represent simultaneously (on the same graph) two relations: one is simmetric, the other is not.

Targets:

  • Ideally the two relation should result in edges having different colors;
  • For the symmetric relation I would like not to have double-edges;

Is there a way of doing this with dot?

like image 202
Dacav Avatar asked Nov 05 '12 17:11

Dacav


People also ask

What is a .DOT file graph?

DOT is the text file format of the suite GraphViz. It has a human-readable syntax that describes network data, including subgraphs and elements appearances (i.e. color, width, label).

What language does Graphviz use?

Graphviz is an open-source python module that is used to create graph objects which can be completed using different nodes and edges. It is based on the DOT language of the Graphviz software and in python it allows us to download the source code of the graph in DOT language.


2 Answers

digraph {      A; B; C      subgraph Rel1 {         edge [dir=none, color=red]         A -> B -> C -> A     }      subgraph Rel2 {         edge [color=blue]          B -> C         C -> A     }  } 

enter image description here

like image 159
Dacav Avatar answered Sep 19 '22 17:09

Dacav


You can pass dir=none as an edge property to the undirected graph connections:

digraph {      A; B; C          A -> B     B -> C     C -> A [dir=none] }  

enter image description here

like image 35
dangom Avatar answered Sep 17 '22 17:09

dangom