netkit.graph.edgecreator
Interface EdgeCreator

All Known Implementing Classes:
BaseCategoricalEdgeCreator, BaseNumericEdgeCreator, BayesCategoricalEdgeCreator, CosineDistanceEdgeCreator, EdgeCreatorImp, EuclideanDistanceEdgeCreator, GaussianNumericEdgeCreator, MahalanobisDistanceEdgeCreator, NormalizedNumericEdgeCreator

public interface EdgeCreator


Method Summary
 void buildModel(DataSplit split)
          Build a model of edge creation based on the data split.
 boolean canHandle(Attribute attribute)
          Queries the edge creator if it can handle (i.e., create edges for) the given attribute.
 boolean canHandleAttributeValue(Attribute attribute)
          Queries the edge creator if it can handle (i.e., create edges for) the given attribute using a specific attribute value.
 Edge[] createEdges()
          Create all the edges on the graph provided in the initialize method (indirectly through the DataSplit object).
 double getAssortativity(boolean useTruth)
          Compute the node-based assortativity of this edge creator.
 int getAttributeIndex()
          Which attribute is this based on.
 double getAttributeValue()
          Which attribute value is this based on.
 EdgeType getEdgeType()
           
 int getMaxEdges()
          How many edges should there be at maximum per node?
 java.lang.String getName()
          The name of this edge-creator
 double getWeight(Node src, Node dest)
          Calculate the edgeweight from node src to node dest.
 void initialize(Graph graph, java.lang.String nodeType, int attributeIndex, double attributeValue, int maxEdges)
          Initialize this creator.
 boolean isByAttribute()
          Is this edge creator by attribute or by instance as a whole
 boolean isByAttributeValue()
          Is this edge creator by attribute value or by attribute as a whole
 

Method Detail

getWeight

double getWeight(Node src,
                 Node dest)
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.

getName

java.lang.String getName()
The name of this edge-creator


getEdgeType

EdgeType getEdgeType()

getAttributeIndex

int getAttributeIndex()
Which attribute is this based on.


getMaxEdges

int getMaxEdges()
How many edges should there be at maximum per node?


getAttributeValue

double getAttributeValue()
Which attribute value is this based on.


isByAttribute

boolean isByAttribute()
Is this edge creator by attribute or by instance as a whole


isByAttributeValue

boolean isByAttributeValue()
Is this edge creator by attribute value or by attribute as a whole


initialize

void initialize(Graph graph,
                java.lang.String nodeType,
                int attributeIndex,
                double attributeValue,
                int maxEdges)
                throws java.lang.IllegalStateException
Initialize this creator. This can only be done once

Parameters:
graph - The graph over which to create edges
nodeType - Which nodetype is the node to create edges over
attributeIndex - The attribute index over which to generate edges (ignored for creators that cannot handle attributes)
attributeValue - The attribute value over which to generate edges (ignored for creators that cannot handle values; otherwise ignored if value is Double.NaN)
maxEdges - The maximum number of outgoing edges to create from any given node
Throws:
java.lang.IllegalStateException - if this creator has already been initialized

canHandle

boolean canHandle(Attribute attribute)
Queries the edge creator if it can handle (i.e., create edges for) the given attribute.

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

canHandleAttributeValue

boolean canHandleAttributeValue(Attribute attribute)
Queries the edge creator if it can handle (i.e., create edges for) the given attribute using a specific attribute value.

Parameters:
attribute -
Returns:
true if this edge creator can create edges based on the given Attribute if given a specific attribute value

buildModel

void buildModel(DataSplit split)
Build a model of edge creation based on the data split. Must be called before calling any analytic methods.

Parameters:
split -

getAssortativity

double getAssortativity(boolean useTruth)
                        throws java.lang.IllegalStateException
Compute the node-based assortativity of this edge creator. This is calculated by computing the assortativity of the nodes, using only the edges that this edge creator would create (creating no more then maxEdges outgoing edges per node if possible -- this is provided in the initialize method).

Parameters:
useTruth - Should we compute assortativity based on the whole truth or just the training set
Throws:
java.lang.IllegalStateException - if the creator has not yet been built

createEdges

Edge[] createEdges()
                   throws java.lang.IllegalStateException
Create all the edges on the graph provided in the initialize method (indirectly through the DataSplit object). It will create no more than maxEdges outgoing edges (if possible), as provided in the initialize method.

Throws:
java.lang.IllegalStateException - if the creator has not yet been built