Class LedaGraphWriter
- java.lang.Object
-
- com.jgalgo.io.LedaGraphWriter
-
- All Implemented Interfaces:
GraphWriter<Integer,Integer>
public final class LedaGraphWriter extends Object
Write a graph in 'LEDA' format.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)
andsetEdgesWeightsKey(String)
methods to specify the keys of the weights to write.- Author:
- Barak Ugav
- See Also:
LedaGraphReader
-
-
Constructor Summary
Constructors Constructor Description LedaGraphWriter()
Create a new writer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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.void
writeGraph(Graph<V,E> 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
-
-
-
-
Method Detail
-
setVerticesWeightsKey
public void setVerticesWeightsKey(String verticesWeightsKey)
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:
Graph.verticesWeights(String)
-
setEdgesWeightsKey
public void setEdgesWeightsKey(String edgesWeightsKey)
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:
Graph.edgesWeights(String)
-
writeGraphImpl
public void writeGraphImpl(Graph<Integer,Integer> graph, Writer writer) throws IOException
- Throws:
IOException
-
writeGraph
public final void writeGraph(Graph<V,E> graph, Writer writer)
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
-
-