netkit.graph.edgecreator
Class BaseNumericEdgeCreator

java.lang.Object
  extended by netkit.graph.edgecreator.EdgeCreatorImp
      extended by netkit.graph.edgecreator.BaseNumericEdgeCreator
All Implemented Interfaces:
EdgeCreator
Direct Known Subclasses:
GaussianNumericEdgeCreator, NormalizedNumericEdgeCreator

public class BaseNumericEdgeCreator
extends EdgeCreatorImp


Nested Class Summary
 
Nested classes/interfaces inherited from class netkit.graph.edgecreator.EdgeCreatorImp
EdgeCreatorImp.NbrEntry
 
Field Summary
protected  java.util.Map<Node,java.lang.Integer> nat
           
protected  EdgeCreatorImp.NbrEntry[] nodes
           
 
Fields inherited from class netkit.graph.edgecreator.EdgeCreatorImp
attrib, attributeIndex, attributeValue, edges, edgetype, gm, graph, logger, maxEdges, nodeType, split, trainAssortativity, trueAssortativity
 
Constructor Summary
BaseNumericEdgeCreator()
           
 
Method Summary
protected  void buildEdges()
          build the edges using the current edge creation model.
protected  void buildNodeArray()
           
 boolean canHandle(Attribute attribute)
          Queries the edge creator if it can handle (i.e., create edges for) the given attribute.
 Edge[] getEdgesToNearestNeighbors(Node node)
          Get the edges to the K nearest nodes (highest weight using this edge creator), where max-k was provided during initialization.
 java.lang.String getName()
          The name of this edge-creator
protected  double getValue(Node n)
           
 double getWeight(Node src, Node dest)
          Calculate the edgeweight from node src to node dest.
protected  double getWeightFast(Node src, Node dest)
           
 
Methods inherited from class netkit.graph.edgecreator.EdgeCreatorImp
addCliqueToAssortMatrix, buildModel, canHandleAttributeValue, createEdges, getAssortativity, getAssortativityMatrix, getAttributeIndex, getAttributeValue, getEdgeType, getLabeledNodes, getMaxEdges, initialize, isByAttribute, isByAttributeValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nodes

protected EdgeCreatorImp.NbrEntry[] nodes

nat

protected java.util.Map<Node,java.lang.Integer> nat
Constructor Detail

BaseNumericEdgeCreator

public BaseNumericEdgeCreator()
Method Detail

getName

public java.lang.String getName()
Description copied from interface: EdgeCreator
The name of this edge-creator


getValue

protected double getValue(Node n)

getWeightFast

protected double getWeightFast(Node src,
                               Node dest)

getWeight

public double getWeight(Node src,
                        Node dest)
Description copied from interface: EdgeCreator
Calculate the edgeweight from node src to node dest. Assumes that initialize has already been called, so that the creator knows the graph, the class attribute index and the attribute index

Parameters:
src - The source node
dest - The destination node
Returns:
the weight of the edge, Double.NaN if no edge should be created.

canHandle

public boolean canHandle(Attribute attribute)
Description copied from interface: EdgeCreator
Queries the edge creator if it can handle (i.e., create edges for) the given attribute.

Returns:
true if this edge creator can create edges based on the given Attribute

buildNodeArray

protected void buildNodeArray()

getEdgesToNearestNeighbors

public Edge[] getEdgesToNearestNeighbors(Node node)
Description copied from class: EdgeCreatorImp
Get the edges to the K nearest nodes (highest weight using this edge creator), where max-k was provided during initialization. This goes through all nodes in the graph, so sub-classes should override to provide a more optimized version. This list should include all nearest neighbors, not only those in the 'training set'. It will look for a cutoff in weights less than k, but if the first k weights are all the same then it will look forward to the first cutoff. This may mean that all nodes are neighbors if all weights are the same.

Overrides:
getEdgesToNearestNeighbors in class EdgeCreatorImp
Parameters:
node - The node
Returns:

buildEdges

protected void buildEdges()
Description copied from class: EdgeCreatorImp
build the edges using the current edge creation model. If you want to use the default buildAssortativityMatrix method and if you override this method, then you must add edges such that they are grouped by source node (i.e., all edges with the same source node appear sequentially in the edges array). This assumption is leverage by the default getAssortativityMatrix method for efficiency.

Overrides:
buildEdges in class EdgeCreatorImp