Class GraphHuffman
- java.lang.Object
-
- org.deeplearning4j.graph.models.deepwalk.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 void
buildTree(int[] vertexDegree)
Build the Huffman tree given an array of vertex degreeslong
getCode(int vertexNum)
int
getCodeLength(int vertexNum)
String
getCodeString(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:
getCode
in interfaceBinaryTree
-
getCodeLength
public int getCodeLength(int vertexNum)
- Specified by:
getCodeLength
in interfaceBinaryTree
-
getCodeString
public String getCodeString(int vertexNum)
- Specified by:
getCodeString
in interfaceBinaryTree
-
getPathInnerNodes
public int[] getPathInnerNodes(int vertexNum)
- Specified by:
getPathInnerNodes
in interfaceBinaryTree
-
-