Class LedaGraphWriter
- All Implemented Interfaces:
GraphWriter<Integer,
Integer>
The LEDA format is a simple format for both directed and undirected graphs, used by the LEDA library. Vertices are numbered from 1 to n, and edges are numbered from 1 to m. It support a single weight for vertices and a single weight for edges. The weights can be any primitive, or a string.
By default, the writer will write the graph without any weights. Its possible to write one of the vertices weights
and one of the edges weights in the format. Use the setVerticesWeightsKey(String)
and
setEdgesWeightsKey(String)
methods to specify the keys of the weights to write.
- Author:
- Barak Ugav
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
setEdgesWeightsKey
(String edgesWeightsKey) Set the key of the edges weights to write.void
setVerticesWeightsKey
(String verticesWeightsKey) Set the key of the vertices weights to write.final void
writeGraph
(Graph<Integer, Integer> graph, Writer writer) Write a graph to an I/O writer.void
writeGraphImpl
(Graph<Integer, Integer> graph, Writer writer) Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.jgalgo.io.GraphWriter
writeGraph, writeGraph
-
Constructor Details
-
LedaGraphWriter
public LedaGraphWriter()Create a new writer.
-
-
Method Details
-
setVerticesWeightsKey
Set the key of the vertices weights to write.By default, the writer will write the graph without any weights. Use this method to specify the key of the vertices weights to write.
- Parameters:
verticesWeightsKey
- the key of the vertices weights to write, ornull
to write no vertices weights- See Also:
-
setEdgesWeightsKey
Set the key of the edges weights to write.By default, the writer will write the graph without any weights. Use this method to specify the key of the edges weights to write.
- Parameters:
edgesWeightsKey
- the key of the edges weights to write, ornull
to write no edges weights- See Also:
-
writeGraphImpl
- Throws:
IOException
-
writeGraph
Description copied from interface:GraphWriter
Write a graph to an I/O writer.- Specified by:
writeGraph
in interfaceGraphWriter<V,
E> - Parameters:
graph
- a graphwriter
- an I/O writer to which the graph description will be written to
-