Eclipse上でJgraphTを使いグラフを描こうとしています。
公式サイトには
「Graph Serialization and Export/Import
The default graph implementations provided by JGraphT are serializable as long as you choose vertex and edge types which are themselves serializable.
Serialization is a convenient way to store a graph instance as binary data, but the format is not human-readable, and we don’t make any guarantee of serialization compatibility across JGraphT versions. (In other words, if you serialize a graph with version X, and then attempt to deserialize it with version X+1, an exception may be thrown.)
To address this, JGraphT provides package org.jgrapht.io for exporting and importing graphs in a variety of standard formats. These can also be used for data interchange with other applications.
Continuing our HelloJGraphT example, here’s how to export a graph in GraphViz .dot format:
Java
1 // use helper classes to define how vertices should be rendered, 2 // adhering to the DOT language restrictions 3 ComponentNameProvider<URI> vertexIdProvider = new ComponentNameProvider<URI>() 4 { 5 public String getName(URI uri) 6 { 7 return uri.getHost().replace('.', '_'); 8 } 9 }; 10 ComponentNameProvider<URI> vertexLabelProvider = new ComponentNameProvider<URI>() 11 { 12 public String getName(URI uri) 13 { 14 return uri.toString(); 15 } 16 }; 17 GraphExporter<URI, DefaultEdge> exporter = 18 new DOTExporter<>(vertexIdProvider, vertexLabelProvider, null); 19 Writer writer = new StringWriter(); 20 exporter.exportGraph(hrefGraph, writer); 21 System.out.println(writer.toString());
と書いてあります。
https://jgrapht.org/guide/UserOverview#graph-adapters
しかしこれを貼り付けてもエラーが出ます。(ComponentNameProviderを型にできません、など)
どうすればいいでしょうか?
あなたの回答
tips
プレビュー