|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.algo.Centrality
public class Centrality
This class provides methods to determine various centrality indices of nodes or edges of a graph. Centrality indices serve to quantify an intuitive feeling that in most networks some nodes or edges are "more central" than others. The provided methods assign a value of type double to each node or edge of a graph that represents its centrality. The higher an assigned value the more central the element is considered by the algorithm.
Also, this class provides convenience methods that normalize the returned centrality values to lie within the interval [0..1].
Constructor Summary | |
---|---|
Centrality()
|
Method Summary | |
---|---|
static void |
closenessCentrality(Graph graph,
NodeMap closeness,
boolean directed,
DataProvider edgeCosts)
Computes the closeness centrality for the nodes of a graph. |
static void |
degreeCentrality(Graph graph,
NodeMap centrality,
boolean considerInEdges,
boolean considerOutEdges)
Computes the degree centrality for the nodes of a graph. |
static void |
edgeBetweenness(Graph graph,
EdgeMap centrality,
boolean directed,
DataProvider edgeCosts)
Computes betweenness centrality for each edge of a given graph. |
static void |
graphCentrality(Graph graph,
NodeMap centrality,
boolean directed,
DataProvider edgeCosts)
Computes the graph centrality for the nodes of a graph. |
static void |
nodeBetweenness(Graph graph,
NodeMap centrality,
boolean directed,
DataProvider edgeCosts)
Computes betweenness centrality for each node of a given graph. |
static void |
nodeEdgeBetweenness(Graph graph,
NodeMap nodeCentrality,
EdgeMap edgeCentrality,
boolean directed,
DataProvider edgeCosts)
Computes betweenness centrality for each node and edge of a given graph. |
static void |
normalize(Graph graph,
EdgeMap map)
Like normalize(Graph, NodeMap) , but for EdgeMap. |
static void |
normalize(Graph graph,
NodeMap map)
This method normalizes the double values of a node map by dividing all values by the maximum of all values (maximum norm). |
static void |
weightCentrality(Graph graph,
NodeMap centrality,
boolean considerInEdges,
boolean considerOutEdges,
DataProvider edgeWeights)
Computes the weight centrality for the nodes of a graph. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Centrality()
Method Detail |
---|
public static void nodeBetweenness(Graph graph, NodeMap centrality, boolean directed, DataProvider edgeCosts)
graph
- the input graph.centrality
- return value. A NodeMap which will holds a non-negative centrality value of type double
for each node.directed
- whether to consider the edges of the graph as directed or undirected.
If false, the algorithm traverse every edge in both direction regardless of the direction of the edge.edgeCosts
- if null
the edges of the graph are considered to have equal cost. Otherwise
it must provide a strictly positive double
value (its cost) for every edge. Invalid values are assumed
to be 1.0
.public static void edgeBetweenness(Graph graph, EdgeMap centrality, boolean directed, DataProvider edgeCosts)
nodeBetweenness(Graph, NodeMap, boolean, DataProvider)
but applied to edges.
centrality
- return value. A EdgeMap which will hold a non-negative centrality value of type double
for each edge.public static void nodeEdgeBetweenness(Graph graph, NodeMap nodeCentrality, EdgeMap edgeCentrality, boolean directed, DataProvider edgeCosts)
nodeBetweenness(Graph, NodeMap, boolean, DataProvider)
but applied to both nodes and edges.
nodeCentrality
- return value. A NodeMap which will hold the centrality value of type double
for every node.edgeCentrality
- return value. A EdgeMap which will hold the centrality value of type double
for every edge.public static void closenessCentrality(Graph graph, NodeMap closeness, boolean directed, DataProvider edgeCosts)
graph
- the input graph.closeness
- return value. A map which hold the centrality value of type double
for every node.directed
- whether to consider the edges of the graph as directed or undirected.edgeCosts
- when null
the edges of the graph are considered to have equal cost. Otherwise
it must provide a non-negative double
value (its cost) for every edge.GraphChecker.isConnected(graph)
public static void graphCentrality(Graph graph, NodeMap centrality, boolean directed, DataProvider edgeCosts)
graph
- the input graph.centrality
- return value. A map which hold the centrality value of type double
for every node.directed
- whether to consider the edges of the graph as directed or undirected.edgeCosts
- when null
the edges of the graph are considered to have equal cost. Otherwise
it must provide a non-negative double
value (its cost) for every edge.public static void degreeCentrality(Graph graph, NodeMap centrality, boolean considerInEdges, boolean considerOutEdges)
graph
- the input graph.centrality
- return value. A map which provides the degree centrality as double
value for every node.considerInEdges
- considerOutEdges
- public static void weightCentrality(Graph graph, NodeMap centrality, boolean considerInEdges, boolean considerOutEdges, DataProvider edgeWeights)
null
then
degreeCentrality
is invoked instead.
graph
- The input graph.centrality
- Return value.
A map which provides the value centrality as double
value for
every node.considerInEdges
- Whether the weights associated with incoming edges should be considered.considerOutEdges
- Whether the weights associated with outgoing edges should be considered.edgeWeights
- When null
the edges of the graph are considered to have uniform
weight of 1.0.
Otherwise it must provide a non-negative double
value (the weight)
for every edge.public static void normalize(Graph graph, NodeMap map)
double
values of a node map by dividing all values by the maximum of all values (maximum norm).
Note, if the maximum value is Double.POSITIVE_INFINITY
, all values other than Double.POSITIVE_INFINITY
are set to 0
.
graph
- the input graphmap
- return value that holds double
values between zero and one.public static void normalize(Graph graph, EdgeMap map)
normalize(Graph, NodeMap)
, but for EdgeMap.
graph
- the input graphmap
- return value that holds double
values between zero and one.
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |