edu.iu.iv.modeling.p2p.pru
Class PruNetwork

java.lang.Object
  |
  +--edu.iu.iv.modeling.p2p.pru.PruNetwork

public class PruNetwork
extends java.lang.Object

PRU Network Model for Unstructured P2P Networks

Author:
Hardik Sheth (hsheth@indiana.edu)

Constructor Summary
PruNetwork()
          Constructor for PRU Network model
PruNetwork(int networkSize, int cacheSize, int lowerBound, int upperBound)
          Constructor for PRU Network model.
 
Method Summary
 boolean buildPruNetwork()
          Build PRU Network Model
 float getAvgDegree()
          Get average degree of the network
 int getCacheSize()
          Returns the number of nodes in the cache
 java.lang.String getFailReason()
          Get the reason because of which modelig failed
 edu.uci.ics.jung.graph.Graph getGraph()
          Returns the network in the form of a graph
 int[] getHostCache()
          Returns the host cache of nodes
 int getLowerBound()
          Returns the minimum degree of nodes in the network
 int getMaxDegree()
          Get max degree of the network
 int getMinDegree()
          Get min degree of the network
 int getNetworkSize()
          Returns the size of the network
 int getUpperBound()
          Returns the maximum degree of nodes in the network
 void printNetwork()
          Print the network graph
 void setCacheSize(int cacheSize)
          Sets the number of nodes in the cache
 void setLowerBound(int minDegree)
          Sets the minimum degree of nodes in the network
 void setNetworkSize(int networkSize)
          Sets the size of the network
 void setUpperBound(int maxDegree)
          Sets the maximum degree of nodes in the network
 void writeGraph(java.lang.String filename)
          Write the graph to a file
 void writePajekFile(java.lang.String filename)
          Create a Pajek file
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PruNetwork

public PruNetwork()
Constructor for PRU Network model


PruNetwork

public PruNetwork(int networkSize,
                  int cacheSize,
                  int lowerBound,
                  int upperBound)
Constructor for PRU Network model. Sets the network size, node degree, minimum degree and maximum degree.

Parameters:
networkSize - size of the network
cacheSize - number of nodes in the cache
lowerBound - minimum degree
upperBound - maximum degree
Method Detail

buildPruNetwork

public boolean buildPruNetwork()
Build PRU Network Model

Returns:
true if the network built, false otherwise

getCacheSize

public int getCacheSize()
Returns the number of nodes in the cache

Returns:
number of nodes in the cache

getGraph

public edu.uci.ics.jung.graph.Graph getGraph()
Returns the network in the form of a graph

Returns:
graph

getHostCache

public int[] getHostCache()
Returns the host cache of nodes

Returns:
hostCache

getLowerBound

public int getLowerBound()
Returns the minimum degree of nodes in the network

Returns:
minimum degree

getNetworkSize

public int getNetworkSize()
Returns the size of the network

Returns:
network size

getUpperBound

public int getUpperBound()
Returns the maximum degree of nodes in the network

Returns:
maximum degree

setCacheSize

public void setCacheSize(int cacheSize)
Sets the number of nodes in the cache

Parameters:
cacheSize -

setLowerBound

public void setLowerBound(int minDegree)
Sets the minimum degree of nodes in the network

Parameters:
minDegree -

setNetworkSize

public void setNetworkSize(int networkSize)
Sets the size of the network

Parameters:
networkSize -

setUpperBound

public void setUpperBound(int maxDegree)
Sets the maximum degree of nodes in the network

Parameters:
maxDegree -

printNetwork

public void printNetwork()
Print the network graph


writePajekFile

public void writePajekFile(java.lang.String filename)
Create a Pajek file


writeGraph

public void writeGraph(java.lang.String filename)
Write the graph to a file


getAvgDegree

public float getAvgDegree()
Get average degree of the network

Returns:
average degree

getMaxDegree

public int getMaxDegree()
Get max degree of the network

Returns:
max degree

getMinDegree

public int getMinDegree()
Get min degree of the network

Returns:
min degree

getFailReason

public java.lang.String getFailReason()
Get the reason because of which modelig failed

Returns:
reason