|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuchicago.src.sim.network.NetUtilities
public class NetUtilities
Performs various common operations on passed networks and returns them, and/or returns a statistic on a passed network and returns the result. Please note that these may be fairly "naive" algorithm implementations, and no guarantees are made about the accuracy of the statistics. The intention is that these may be used for "on the fly" qualitative evaluation of a model, but real network statistics should be done with more serious software such as UCINET or Pajek.
ALL THE METHODS CAN BE CONSIDERED BETA AND SHOULD ONLY BE USED FOR "ON THE FLY" CALCULATIONS. ACTUAL NETWORK STATISTICS SHOULD BE DONE WITH DEDICATED NETWORK ANALYSIS SOFTWARE, SUCH AS PAJEK OR UCINET.
| Constructor Summary | |
|---|---|
NetUtilities()
No-Argument constructor for convenience / aliasing. |
|
| Method Summary | |
|---|---|
static double |
calcAvgPathLength(java.util.List nodes)
Returns a double equal to the average or "characteristic" path length of the graph. |
static double |
calcClustCoef(java.util.List nodes)
Calculates the clustering coefficient (avg. density of "ego networks") in graph. |
static double |
calcDensity(java.util.List nodes)
calculates density (ratio of arcs in network to maximum possible number of arcs) of passed network. |
static double |
calcDensity(java.util.List nodes,
boolean collapseMulti)
Calculates density of the network, but if collapseMulti is true, it first collapses any multiplex ties. |
static double |
calcDiameter(java.util.List nodes)
Returns a double equal to the graph-theoretic diameter of the passed network (the length of the longest shortest path). |
static double |
calcSymmetry(java.util.List nodes)
Returns a double indicating the amount of symmetry in the network: fraction of existing i -> j ties for which there is a j -> i tie. |
static int |
countIJTies(Node iNode,
Node jNode)
Returns the number of ties from i to j. |
static int |
getAllDegree(Node iNode)
Returns the number of arcs node is involved in. |
static cern.colt.matrix.impl.DenseDoubleMatrix2D |
getAllShortPathMatrix(java.util.List nodes)
Returns a DenseDoubleMatrix2D in which the i,j th entry gives the length of the shortest path between i and j. i and j indexes refer to the position of the node in the ArrayList parameter. |
static java.util.ArrayList |
getComponents(java.util.List nodes)
Returns an ArrayList of length equal to the number of components in the graph, each entry of which is an ArrayList of the nodes in that component. |
static double |
getIJShortPathLength(java.util.List nodes,
Node iNode,
Node jNode)
Returns a double with a value equal to the length of the shortest path between i and j. |
static int |
getIJTie(Node iNode,
Node jNode)
Returns 1 if a tie from i to j exists, 0 otherwise. |
static double |
getIJTieStrength(Node iNode,
Node jNode)
Returns double value from getStrength() if tie from i to j exists, returns 0.0 if none exists. |
static int |
getInDegree(Node iNode)
Returns the in degree (number of in edges) of the node. |
static int |
getNumDirectTriads(Node iNode,
Node jNode)
Finds and returns the number of "parents" (nodes with links TO both i and j) |
static int |
getOutDegree(Node iNode)
Returns the out degree (number of out edges) of the node. |
static java.lang.String |
getStatsString(java.util.List nodes)
Returns a string, each line of which consists of the name of a graph statistic and its value. |
static boolean |
hasSelfLoops(java.util.List nodes)
Returns a boolean indicating whether the network contains self-loops (links from i -> i) |
static boolean |
isMultiplexNet(java.util.List nodes)
Checks if there are any nodes i j for which there is more than one tie i -> j (almost all network statistics assume that the network is NOT multiplex) |
static java.util.List |
randomRewire(java.util.List nodes,
double rewireProb)
Returns a network of the same size and density as the passed network, but randomly "rewires" a fraction of the edges to randomly chosen target nodes. |
static java.util.List |
randomRewireSymmetric(java.util.List nodes,
double rewireProb)
Returns a network of the same size and density as the passed network, but randomly "rewires" a fraction of the edges to randomly chosen target nodes. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public NetUtilities()
| Method Detail |
|---|
public static double calcClustCoef(java.util.List nodes)
nodes - the network for which the ClustCoef will be calculatedpublic static double calcDensity(java.util.List nodes)
public static double calcDensity(java.util.List nodes,
boolean collapseMulti)
nodes - the ArrayList of nodes to examinepublic static boolean isMultiplexNet(java.util.List nodes)
public static boolean hasSelfLoops(java.util.List nodes)
nodes - the ArrayList of nodes to examine for loops
public static int getIJTie(Node iNode,
Node jNode)
iNode - the node the tie is fromjNode - the node the tie is to
public static double getIJTieStrength(Node iNode,
Node jNode)
iNode - the node the tie is fromjNode - the node the tie is to
public static int countIJTies(Node iNode,
Node jNode)
iNode - the node ties are fromjNode - the node ties are topublic static int getOutDegree(Node iNode)
iNode - the node the degree will be returned forpublic static int getInDegree(Node iNode)
iNode - the node the degree will be returned forpublic static int getAllDegree(Node iNode)
iNode - the node the degree will be returned for
public static int getNumDirectTriads(Node iNode,
Node jNode)
iNode - one node of triadjNode - the second node of the triad
public static double getIJShortPathLength(java.util.List nodes,
Node iNode,
Node jNode)
nodes - the complete network of nodesiNode - the originating node for the pathjNode - the destination node for the pathpublic static cern.colt.matrix.impl.DenseDoubleMatrix2D getAllShortPathMatrix(java.util.List nodes)
nodes - the network which the matrix will be returned forpublic static double calcDiameter(java.util.List nodes)
nodes - the network for which the diameter will be calculatedpublic static double calcAvgPathLength(java.util.List nodes)
nodes - the network to evaluatepublic static double calcSymmetry(java.util.List nodes)
nodes - the network to evaluate for symmetrypublic static java.util.ArrayList getComponents(java.util.List nodes)
nodes - the network in which components will be counted
public static java.util.List randomRewire(java.util.List nodes,
double rewireProb)
rewireProb - the fraction of edges to rewire
public static java.util.List randomRewireSymmetric(java.util.List nodes,
double rewireProb)
rewireProb - the fraction of edges to rewirepublic static java.lang.String getStatsString(java.util.List nodes)
nodes - the network for which the statistics will be calculated
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||