Class GraphHuffman
- java.lang.Object
-
- org.deeplearning4j.models.sequencevectors.graph.huffman.GraphHuffman
-
- All Implemented Interfaces:
BinaryTree
public class GraphHuffman extends Object implements BinaryTree
-
-
Constructor Summary
Constructors Constructor Description GraphHuffman(int nVertices)GraphHuffman(int nVertices, int maxCodeLength)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbuildTree(int[] vertexDegree)Build the Huffman tree given an array of vertex degreeslonggetCode(int vertexNum)intgetCodeLength(int vertexNum)List<Integer>getCodeList(int vertexNum)StringgetCodeString(int vertexNum)int[]getPathInnerNodes(int vertexNum)
-
-
-
Constructor Detail
-
GraphHuffman
public GraphHuffman(int nVertices)
- Parameters:
nVertices- number of vertices in the graph that this Huffman tree is being built for
-
GraphHuffman
public GraphHuffman(int nVertices, int maxCodeLength)- Parameters:
nVertices- nVertices number of vertices in the graph that this Huffman tree is being built formaxCodeLength- MAX_CODE_LENGTH for Huffman tree
-
-
Method Detail
-
buildTree
public void buildTree(int[] vertexDegree)
Build the Huffman tree given an array of vertex degrees- Parameters:
vertexDegree- vertexDegree[i] = degree of ith vertex
-
getCode
public long getCode(int vertexNum)
- Specified by:
getCodein interfaceBinaryTree
-
getCodeLength
public int getCodeLength(int vertexNum)
- Specified by:
getCodeLengthin interfaceBinaryTree
-
getCodeString
public String getCodeString(int vertexNum)
- Specified by:
getCodeStringin interfaceBinaryTree
-
getPathInnerNodes
public int[] getPathInnerNodes(int vertexNum)
- Specified by:
getPathInnerNodesin interfaceBinaryTree
-
-