22 * questions. |
22 * questions. |
23 */ |
23 */ |
24 |
24 |
25 /** |
25 /** |
26 * Send your graphs to <b>IGV</b> via a socket or a file. This package allows one to easily encode |
26 * Send your graphs to <b>IGV</b> via a socket or a file. This package allows one to easily encode |
27 * any graph-like data structure and send it for visualization to |
27 * any graph-like data structure and send it for visualization to <em>OracleLab's Ideal Graph |
28 * <em>OracleLab's Ideal Graph Visualizer</em> tool. Assuming you already have your own data |
28 * Visualizer</em> tool. Assuming you already have your own data structure that contains |
29 * structure that contains <b>nodes</b> and <b>edges</b> among them, creating a |
29 * <b>nodes</b> and <b>edges</b> among them, creating a {@link org.graalvm.graphio.GraphOutput} |
30 * {@link org.graalvm.graphio.GraphOutput} specialized for your data is a matter of implementing a |
30 * specialized for your data is a matter of implementing a single interface: |
31 * single interface: |
|
32 * |
31 * |
33 * {@link org.graalvm.graphio.GraphSnippets#acmeGraphStructure} |
32 * {@link org.graalvm.graphio.GraphJavadocSnippets#acmeGraphStructure} |
34 * |
33 * |
35 * The {@link org.graalvm.graphio.GraphStructure} interface defines the set of operations that are |
34 * The {@link org.graalvm.graphio.GraphStructure} interface defines the set of operations that are |
36 * needed by the <em>graph protocol</em> to encode a graph into the <b>IGV</b> expected format. The |
35 * needed by the <em>graph protocol</em> to encode a graph into the <b>IGV</b> expected format. The |
37 * graph structure is implemented as a so called |
36 * graph structure is implemented as a so called |
38 * <a href="http://wiki.apidesign.org/wiki/Singletonizer">singletonizer</a> API pattern: there is no |
37 * <a href="http://wiki.apidesign.org/wiki/Singletonizer">singletonizer</a> API pattern: there is no |
41 * <p> |
40 * <p> |
42 * The next step is to turn this graph structure into an instance of |
41 * The next step is to turn this graph structure into an instance of |
43 * {@link org.graalvm.graphio.GraphOutput}. To do so use the associated |
42 * {@link org.graalvm.graphio.GraphOutput}. To do so use the associated |
44 * {@link org.graalvm.graphio.GraphOutput.Builder builder} just like shown in the following method: |
43 * {@link org.graalvm.graphio.GraphOutput.Builder builder} just like shown in the following method: |
45 * |
44 * |
46 * {@link org.graalvm.graphio.GraphSnippets#buildOutput} |
45 * {@link org.graalvm.graphio.GraphJavadocSnippets#buildOutput} |
47 * |
46 * |
48 * Now you are ready to dump your graph into <b>IGV</b>. Where to obtain the right channel? One |
47 * Now you are ready to dump your graph into <b>IGV</b>. Where to obtain the right channel? One |
49 * option is to create a {@link java.nio.channels.FileChannel} and dump the data into a file |
48 * option is to create a {@link java.nio.channels.FileChannel} and dump the data into a file |
50 * (preferrably with <code>.bgv</code> extension). The other is to open a socket to port |
49 * (preferrably with <code>.bgv</code> extension). The other is to open a socket to port |
51 * <code>4445</code> (the default port <b>IGV</b> listens to) and dump the data there. Here is an |
50 * <code>4445</code> (the default port <b>IGV</b> listens to) and dump the data there. Here is an |
52 * example: |
51 * example: |
53 * |
52 * |
54 * {@link org.graalvm.graphio.GraphSnippets#dump} |
53 * {@link org.graalvm.graphio.GraphJavadocSnippets#dump} |
55 * |
54 * |
56 * Call the {@code dump} method with pointer to file {@code diamond.bgv} and then you can open the |
55 * Call the {@code dump} method with pointer to file {@code diamond.bgv} and then you can open the |
57 * file in <b>IGV</b>. The result will look like this: |
56 * file in <b>IGV</b>. The result will look like this: |
58 * <p> |
57 * <p> |
59 * <img src="doc-files/diamond.png"> |
58 * <img src="doc-files/diamond.png"> |
73 * {@link org.graalvm.graphio.GraphElements} and {@link org.graalvm.graphio.GraphTypes}) are |
72 * {@link org.graalvm.graphio.GraphElements} and {@link org.graalvm.graphio.GraphTypes}) are |
74 * optional - they don't have to be provided. As such they can be specified via |
73 * optional - they don't have to be provided. As such they can be specified via |
75 * {@link org.graalvm.graphio.GraphOutput.Builder} instance methods, which may, but need not be |
74 * {@link org.graalvm.graphio.GraphOutput.Builder} instance methods, which may, but need not be |
76 * called at all. Here is an example: |
75 * called at all. Here is an example: |
77 * |
76 * |
78 * {@link org.graalvm.graphio.GraphSnippets#buildAll} |
77 * {@link org.graalvm.graphio.GraphJavadocSnippets#buildAll} |
79 * |
78 * |
80 * All these interfaces follow the |
79 * All these interfaces follow the |
81 * <a href="http://wiki.apidesign.org/wiki/Singletonizer">singletonizer</a> API pattern again - e.g. |
80 * <a href="http://wiki.apidesign.org/wiki/Singletonizer">singletonizer</a> API pattern again - e.g. |
82 * no need to change your existing data structures, just implement the operations provided by the |
81 * no need to change your existing data structures, just implement the operations provided by the |
83 * interfaces you pass into the builder. By combining these interfaces together you can get as rich, |
82 * interfaces you pass into the builder. By combining these interfaces together you can get as rich, |