Package it.unimi.dsi.law.webgraph
Class CompressedIntLabel
java.lang.Object
it.unimi.dsi.webgraph.labelling.AbstractLabel
it.unimi.dsi.webgraph.labelling.AbstractIntLabel
it.unimi.dsi.law.webgraph.CompressedIntLabel
- All Implemented Interfaces:
FlyweightPrototype<Label>,Label,Serializable
public class CompressedIntLabel extends AbstractIntLabel implements Serializable
An integer label that uses a coder/decoder pair depending on the source node.
This is a kind of int label whose serialization (fromBitStream(InputBitStream, int)
and toBitStream(OutputBitStream, int) methods) rely on a coder/decoder pair that may depend on the source node of the arc.
Different constructors provide different ways to assign coders/decoders to source nodes: consult their documentation for more information.
More precisely, the public field nodeLabels exposes a list of labels for nodes. Decoders are chosen depending on the label provided
by the list.
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description static booleanDEBUGLongBigListnodeLabelsThe node labels stream containing the node labels.Fields inherited from class it.unimi.dsi.webgraph.labelling.AbstractIntLabel
key, valueFields inherited from interface it.unimi.dsi.webgraph.labelling.Label
EMPTY_LABEL_ARRAY -
Constructor Summary
Constructors Modifier Constructor Description CompressedIntLabel(Object directory, String key, String value, String labels, String nodeWidth, String decoders)Creates a compressed integer label from a specification that includes just decoders.CompressedIntLabel(Object directory, String key, String value, String labels, String nodeWidth, String decoders, String coders)Creates a compressed integer label from a specification that includes decoders and coders.CompressedIntLabel(String key, int value, LongBigList nodeLabels, Int2ObjectMap<Decoder> sourceLabel2Decoder, Int2ObjectMap<Coder> sourceLabel2Coder)Creates a compressed integer label.protectedCompressedIntLabel(String key, int value, String labelSpec, LongBigList nodeLabels, Int2ObjectMap<Coder> source2Coder, Int2ObjectMap<Decoder> source2Decoder) -
Method Summary
Modifier and Type Method Description CompressedIntLabelcopy()intfixedWidth()intfromBitStream(InputBitStream inputBitStream, int source)inttoBitStream(OutputBitStream outputBitStream, int source)StringtoSpec()Methods inherited from class it.unimi.dsi.webgraph.labelling.AbstractIntLabel
attributeKeys, attributeTypes, equals, get, get, getDouble, getDouble, getFloat, getFloat, getInt, getInt, getLong, getLong, hashCode, toString, wellKnownAttributeKeyMethods inherited from class it.unimi.dsi.webgraph.labelling.AbstractLabel
getBoolean, getBoolean, getByte, getByte, getChar, getChar, getShort, getShortMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface it.unimi.dsi.webgraph.labelling.Label
getBoolean, getBoolean, getByte, getByte, getChar, getChar, getShort, getShort
-
Field Details
-
DEBUG
public static final boolean DEBUG- See Also:
- Constant Field Values
-
nodeLabels
The node labels stream containing the node labels.
-
-
Constructor Details
-
CompressedIntLabel
protected CompressedIntLabel(String key, int value, String labelSpec, LongBigList nodeLabels, Int2ObjectMap<Coder> source2Coder, Int2ObjectMap<Decoder> source2Decoder) -
CompressedIntLabel
public CompressedIntLabel(String key, int value, LongBigList nodeLabels, Int2ObjectMap<Decoder> sourceLabel2Decoder, Int2ObjectMap<Coder> sourceLabel2Coder)Creates a compressed integer label.- Parameters:
key- the key.value- the value.nodeLabels- the node labels.sourceLabel2Decoder- a map assigning a decoder to every possible node label; note that the number of node labels is 2w, where w isnodeLabelPrototype.fixedWidth().sourceLabel2Coder- an optional map assigning a coder to every possible node label, ornull; note that the number of node labels is 2w, where w isnodeLabelPrototype.fixedWidth().
-
CompressedIntLabel
public CompressedIntLabel(Object directory, String key, String value, String labels, String nodeWidth, String decoders, String coders) throws NumberFormatException, FileNotFoundException, IOException, ClassNotFoundExceptionCreates a compressed integer label from a specification that includes decoders and coders.Warning: the entire node-label stream is loaded into memory by this method.
- Parameters:
key- the key of this label.value- the value of this label.labels- the filename of the file of labels.nodeWidth- the width in bits of a node label.decoders- the filename of a serialisedInt2ObjectMapmapping node labels to decoders.coders- the filename of a serialisedInt2ObjectMapmapping node labels to coders.- Throws:
NumberFormatExceptionFileNotFoundExceptionIOExceptionClassNotFoundException
-
CompressedIntLabel
public CompressedIntLabel(Object directory, String key, String value, String labels, String nodeWidth, String decoders) throws NumberFormatException, FileNotFoundException, IOException, ClassNotFoundExceptionCreates a compressed integer label from a specification that includes just decoders.Warning: the entire node-label stream is loaded into memory by this method.
- Parameters:
key- the key of this label.value- the value of this label.labels- the filename of the file of nodes labels.nodeWidth- the width in bits of a node label.decoders- the filename of a serialisedInt2ObjectMapmapping node labels to decoders.- Throws:
NumberFormatExceptionFileNotFoundExceptionIOExceptionClassNotFoundException
-
-
Method Details
-
copy
- Specified by:
copyin interfaceFlyweightPrototype<Label>- Specified by:
copyin interfaceLabel
-
fromBitStream
- Specified by:
fromBitStreamin interfaceLabel- Throws:
IOException
-
toBitStream
- Specified by:
toBitStreamin interfaceLabel- Throws:
IOException
-
fixedWidth
public int fixedWidth()- Specified by:
fixedWidthin interfaceLabel
-
toSpec
-