public class TLcdNumericGraphEncoder extends Object implements ILcdOutputStreamFactoryCapable
TLcdNumericGraph
for a description of
how these numerical identifiers are computed).
The result will be written to disk incrementally, to allow processing of very large graphs which
do not fit completely in memory.
All mappings are reported to the user via a ILcdNumericGraphMappingHandler
callback.
If the graph is exported with an edge value function, the encoder will automatically encode the
edge values and compute and encode the distance tables as well.
TLcdNumericGraphEncoder.EdgeValueEncoding
documentation
for more information on the available encodings.Modifier and Type | Class and Description |
---|---|
static class |
TLcdNumericGraphEncoder.EdgeValueEncoding
Enumeration describing the encoding of edge values.
|
Constructor and Description |
---|
TLcdNumericGraphEncoder() |
Modifier and Type | Method and Description |
---|---|
<N,E> void |
exportEdgeValueFunction(ILcdGraph<N,E> aGraph,
ILcdEdgeValueFunction<N,E> aEdgeValueFunction,
String aTopologySourceName,
String aEdgeValuesDestinationName)
Exports the specified edge value function for the specified graph.
|
<N,E> void |
exportGraph(ILcdGraph<N,E> aGraph,
ILcdEdgeValueFunction<N,E> aEdgeValueFunction,
ILcdNumericGraphMappingHandler<N,E> aMappingHandler,
String aTopologyDestinationName,
String aEdgeValuesDestinationName)
Export the specified graph and edge value function to a numeric graph.
|
TLcdNumericGraphEncoder.EdgeValueEncoding |
getEdgeValueEncoding()
Returns the encoding mode for encoding edge values.
|
int |
getExpansionSize()
Returns the number of extra slots that is reserved in each partition for adding extra edges after
the graph has been converted to a numeric graph.
|
int[] |
getNodeSplitThresholds()
Return for each level in the graph hierarchy the minimum number of nodes a partition should
have before being encoded to a separate file.
|
ILcdOutputStreamFactory |
getOutputStreamFactory()
Returns the
com.luciad.io.ILcdOutputStreamFactory which is used for creating output streams. |
void |
saveGraph(TLcdNumericGraph aGraph)
Saves a numeric graph to the location it was decoded from.
|
void |
setEdgeValueEncoding(TLcdNumericGraphEncoder.EdgeValueEncoding aValueEncoding)
Sets the encoding mode for encoding edge values.
|
void |
setExpansionSize(int aExpansionSize)
Sets the number of extra slots to be reserved in each partition for adding extra edges after
the graph has been converted to a numeric graph.
|
void |
setNodeSplitThresholds(int[] aNodeSplitThresholds)
Sets for each level in the graph hierarchy the minimum number of nodes a partition should have
before being encoded to a separate file.
|
void |
setOutputStreamFactory(ILcdOutputStreamFactory aOutputStreamFactory)
Sets the
com.luciad.io.ILcdOutputStreamFactory to be used for creating output streams. |
public void setExpansionSize(int aExpansionSize)
aExpansionSize
- the number of extra slots to be reserved in each partition for adding
extra edges after the graph has been converted to a numeric graph.getExpansionSize()
public int getExpansionSize()
getExpansionSize()
public TLcdNumericGraphEncoder.EdgeValueEncoding getEdgeValueEncoding()
setEdgeValueEncoding(EdgeValueEncoding)
public void setEdgeValueEncoding(TLcdNumericGraphEncoder.EdgeValueEncoding aValueEncoding)
TLcdNumericGraphEncoder.EdgeValueEncoding.STANDARD
.aValueEncoding
- the encoding mode for encoding edge values.getEdgeValueEncoding()
public void setNodeSplitThresholds(int[] aNodeSplitThresholds)
-1
or beyond the size
of the specified array will never be split.
The default split configuration is {-1,1000} (partitions on the highest level will never be split,
partitions on the second level will be split if the number of nodes is larger than 1000, lower level
partitions will never be split).aNodeSplitThresholds
- the array with node split thresholds for which a file split should be
considered.getNodeSplitThresholds()
public int[] getNodeSplitThresholds()
setNodeSplitThresholds(int[])
public ILcdOutputStreamFactory getOutputStreamFactory()
com.luciad.io.ILcdOutputStreamFactory
which is used for creating output streams.getOutputStreamFactory
in interface ILcdOutputStreamFactoryCapable
setOutputStreamFactory(com.luciad.io.ILcdOutputStreamFactory)
public void setOutputStreamFactory(ILcdOutputStreamFactory aOutputStreamFactory)
com.luciad.io.ILcdOutputStreamFactory
to be used for creating output streams.
By default, a com.luciad.io.TLcdFileOutputStreamFactory
is used.setOutputStreamFactory
in interface ILcdOutputStreamFactoryCapable
aOutputStreamFactory
- the factory to be used for creating output streams.getOutputStreamFactory()
public <N,E> void exportGraph(ILcdGraph<N,E> aGraph, ILcdEdgeValueFunction<N,E> aEdgeValueFunction, ILcdNumericGraphMappingHandler<N,E> aMappingHandler, String aTopologyDestinationName, String aEdgeValuesDestinationName) throws IOException
com.luciad.network.graph.numeric.ILcdNumericGraphMappingHandler
that is specified.aGraph
- the graph to be converted to a numeric graph.aEdgeValueFunction
- the edge value function describing the weights of the edges in the graph.aMappingHandler
- the mapping handler to which all node and edge mappings should be reported.aTopologyDestinationName
- the destination name for the main graph file.aEdgeValuesDestinationName
- the destination name for the main graph values file.IOException
- if an I/O exception occurs while exporting.public void saveGraph(TLcdNumericGraph aGraph) throws IOException
aGraph
- the graph to be saved.IOException
- if an I/O exception occurs while saving.public <N,E> void exportEdgeValueFunction(ILcdGraph<N,E> aGraph, ILcdEdgeValueFunction<N,E> aEdgeValueFunction, String aTopologySourceName, String aEdgeValuesDestinationName) throws IOException
getNodes()
, getEdges()
and
getPartitions()
methods return the same sequence (same order) of nodes/edges/partitions,
as during the original encoding. Also, the encoding parameters (node split threshold, split levels
and expansion size) should be identical to the ones used during the original encoding.aGraph
- the graph for which to export an edge value function.aEdgeValueFunction
- the edge value function to export.aTopologySourceName
- the location of the main graph topology file.aEdgeValuesDestinationName
- the location of the main edge value file where the values
should be stored.IOException
- if an I/O exception occurs while exporting.