I'm currently writing a graphs library in Java, and I would like a tool to visualize some graphs. I discovered Graph-viz, which happens to be a great - although buggy - way of doing this.
In my model, Graphs are composed of Nodes and Edges. Every Node have a certain number of Ports (I/O/IO) and Edges link those Ports together. Some special nodes are called GraphNodes and embed a Graph. The Ports of these GraphNodes are mapped to some Ports of the internal Nodes.
I'd like to provide several representation. The first of them, with which I am satisfied, is as follows: https://i.sstatic.net/ujU71.png
The input Ports are represented in green, the output ones in red, and the input-output ones in blue.
In this representation, the GraphNodes are not expanded and are displayed just as simple Nodes. In a second version, I would like to create something that looks like the following picture: https://i.sstatic.net/Cx624.png
The problem is that I can't manage to create a sub-graph (cluster) with fixed areas (it seems not to be possible). Another solution I tried was to embed a graph into a node. However, inserting some code into the <td> </td>
part of a HTML label does not evaluate the code:
digraph graph0
{
node1
[
label =
<
<table border="0" cellspacing="0">
<tr>
<td cellpadding="0">
<table border="0" cellspacing="0">
<tr>
<td bgcolor="palegreen" border="1" port="port2">port2</td>
<td bgcolor="palegreen" border="1" port="port3">port3</td>
</tr>
</table>
</td>
</tr>
<tr>
<td cellpadding="0">
<table border="0" cellspacing="0">
<tr>
<td cellpadding="0">
<table border="0" cellspacing="0">
<tr>
<td bgcolor="skyblue" border="1" port="port5">port5</td>
</tr>
</table>
</td>
<td bgcolor="peachpuff" border="1">
subgraph clusterTest
{
nodeTest
}
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td cellpadding="0">
<table border="0" cellspacing="0">
<tr>
<td bgcolor="lightpink" border="1" port="port4">port4</td>
</tr>
</table>
</td>
</tr>
</table>
>
style = "invisible"
]
}
The previous code creates the following graph: https://i.sstatic.net/E9jQ1.png
Finally, the best solution I can come up with is the following: https://i.sstatic.net/VzS5g.png
However I am not satisfied with it, because the GraphNodes' Ports are placed in strange locations sometimes.
Do you please know how I can reach the target graph layout? Please ask for any other information if needed.
EDIT: I still didn't find any solution. A way to handle this would be to be able to fix the position of given nodes inside the containing cluster, but it seems not to be possible with "dot" layout. Any idea ?