I'm wondering if it's possible to create something like this usint graphviz, where an arrow points from a token/word to the other, instead of a node.
Asked
Active
Viewed 94 times
1
-
I would think about some nodes in a subgraph and having a style that doesn't show the borders (style=none?), Not this is just a thought I didn't test it. – albert Jul 21 '19 at 08:28
-
@albert That sounds promising. I'm new to graphviz and visualization in general, if you can provide an example, I'm happy to accept it as an answer. – laike9m Jul 21 '19 at 20:01
-
As written it was a thought experiment, so please try yourself and show the code you got. (Remember this is a Q&A site, not a please do this for me service and at them moment my time is a bit short as well) – albert Jul 22 '19 at 07:56
1 Answers
1
It is possible to simulate (a lot of things) with tables, though it's usually very ugly in source code:
digraph {
node [shape=plain]
node1 [
label=<
<table cellspacing="0" bgcolor="#d0e2f2" cellborder="0">
<tr><td></td></tr>
<tr><td port="label">foo bar</td></tr>
<tr><td></td></tr>
</table>>
]
node2 [
label=<
<table cellspacing="0" bgcolor="#d0e2f2" cellborder="0">
<tr><td></td></tr>
<tr><td port="label">baz qux</td></tr>
<tr><td></td></tr>
</table>>
]
node1:label:n -> node2:label:n [constraint=false]
}
Result:
What I did here:
- I used a plain node shape and HTML-like label syntax to create a table:
node [shape=plain]
node1 [
label=<>
]
- I added 3 rows for my table, first and last one being empty:
<tr><td></td></tr>
<tr><td port="label">foo bar</td></tr>
<tr><td></td></tr>
The middle row contains the actual label. Also, to be able to point an edge to specific cell I've added a port to it:
<td port="label">foo bar</td>
.Finally when defining an edge I've specified the ports to be connected (documentation on ports):
node1:label:n -> node2:label:n

Dany
- 4,521
- 1
- 15
- 32
-
Interesting answer. So to connect "bar" to "baz", I can probably put "foo" "bar" in different columns, and only set "port" on bar's column? – laike9m Jul 31 '19 at 17:43
-
@laike9m, yes, this will work too, ports make it possible to connect any cells together. We can use this feature to point edges to specific parts of the node (simulating these parts with cells) – Dany Aug 01 '19 at 05:44