de.cesr.more.basic.network
Interface MoreNetwork<AgentType,EdgeType extends MoreEdge<? super AgentType>>

Type Parameters:
AgentType - the common type (of agents) that is contained as nodes in the network
EdgeType - the edge type
All Known Subinterfaces:
MoreRsNetwork<AgentT,EdgeT>
All Known Implementing Classes:
MDirectedNetwork, MRsContextJungNetwork, MRsEncapsulatedContextJungNetwork, MUndirectedNetwork

public interface MoreNetwork<AgentType,EdgeType extends MoreEdge<? super AgentType>>

Specifies demands on network implementations.

Date:
07.01.2010

Method Summary
 void addNode(AgentType node)
          Add a node to the network.
 EdgeType connect(AgentType source, AgentType target)
          If there is already a connection object between these nodes it is removed and the given one added.
 void connect(EdgeType edge)
          Adds an edge to this network.
 boolean containsNode(AgentType node)
          Return true if the given node is contained within this network
 EdgeType disconnect(AgentType source, AgentType target)
           
 Iterable<AgentType> getAdjacent(AgentType ego)
           
 int getDegree(AgentType ego)
           
 EdgeType getEdge(AgentType source, AgentType target)
           
 Collection<EdgeType> getEdgesCollection()
           
 MoreNetwork<AgentType,EdgeType> getGraphFilteredInstance(Graph<AgentType,EdgeType> graph, String new_name)
          The method is used to obtain a new Sub-MoreNetwork.
 int getInDegree(AgentType ego)
           
 Graph<AgentType,EdgeType> getJungGraph()
          Return a JUNG Graph object of this network.
 String getName()
           
 Class<? extends MoreNetworkBuilder<?,?>> getNetworkBuilderClass()
           
 String getNetworkInfo()
          Provides some basic oinformation on the network: - number of links - number of edges - directedness
 Iterable<AgentType> getNodes()
           
 int getOutDegree(AgentType ego)
           
 Iterable<AgentType> getPredecessors(AgentType ego)
           
 AgentType getRandomPredecessor(AgentType ego)
          Return a random neighbour.
 AgentType getRandomSuccessor(AgentType ego)
          Return a random neighbour.
 Iterable<AgentType> getSuccessors(AgentType ego)
           
 double getWeight(AgentType source, AgentType target)
           
 boolean isAdjacent(AgentType ego, AgentType alter)
           
 boolean isDirected()
           
 boolean isSuccessor(AgentType alter, AgentType ego)
          Checks whether there is a link from ego to alter.
 void normalizeWeights()
          Normalises the edges' weights by dividing by the largest weight.
 int numEdges()
           
 int numNodes()
           
 void removeNode(AgentType node)
          Removes a node and all its edges from the network.
 void reverseNetwork()
          Returns a reversed network, i.e. for all edges source and target vertices are exchanged.
 void setEdgeFactory(MoreEdgeFactory<AgentType,EdgeType> edgeFac)
          Sets the MoreEdgeFactory that is used to connect agents.
 void setNetworkBuilderClass(Class<? extends MoreNetworkBuilder<?,?>> builderClass)
           
 void setWeight(AgentType source, AgentType target, double weight)
           
 

Method Detail

addNode

void addNode(AgentType node)
Add a node to the network.

Parameters:
node -

removeNode

void removeNode(AgentType node)
Removes a node and all its edges from the network.

Parameters:
node -

containsNode

boolean containsNode(AgentType node)
Return true if the given node is contained within this network

Parameters:
node -
Returns:
true if the network contains the given node

getGraphFilteredInstance

MoreNetwork<AgentType,EdgeType> getGraphFilteredInstance(Graph<AgentType,EdgeType> graph,
                                                         String new_name)
The method is used to obtain a new Sub-MoreNetwork. The parameter is a Graph instance that contains subsets of vertices and edges in the original MoreNetwork this method is applied to. For instance, such graphs may be a result of a VertexPredicateFilter. The given graph needs to be of corresponding directedness! This (the original) instance of MoreNetwork is not altered!

Returns:
A new MoreNetwork containing only vertices and edges contained in given graph object
Throws:
NoSuchElementException - when the given graph contains a vertex or an edge this network does not contain.

connect

EdgeType connect(AgentType source,
                 AgentType target)
If there is already a connection object between these nodes it is removed and the given one added.

Parameters:
source -
target -
Returns:
the new edge

connect

void connect(EdgeType edge)
Adds an edge to this network. Implementing classes are required to use the edge factory.

Parameters:
edge - to add to the network

disconnect

EdgeType disconnect(AgentType source,
                    AgentType target)
Parameters:
source -
target -

setWeight

void setWeight(AgentType source,
               AgentType target,
               double weight)
Parameters:
source -
target -
weight -

normalizeWeights

void normalizeWeights()
Normalises the edges' weights by dividing by the largest weight.


getWeight

double getWeight(AgentType source,
                 AgentType target)
Parameters:
source -
target -
Returns:
the weight of the edge between source and target node

getAdjacent

Iterable<AgentType> getAdjacent(AgentType ego)
Parameters:
ego -
Returns:
iterable collection of all adjacent nodes (predecessors and successors) to the given node

getRandomSuccessor

AgentType getRandomSuccessor(AgentType ego)
Return a random neighbour. For directed networks, this is a successor.

Parameters:
ego -
Returns:
alter the randomly chosen successor

getRandomPredecessor

AgentType getRandomPredecessor(AgentType ego)
Return a random neighbour. For directed networks, this is a predecessor.

Parameters:
ego -
Returns:
alter the randomly chosen predecessor

getPredecessors

Iterable<AgentType> getPredecessors(AgentType ego)
Parameters:
ego -
Returns:
iterable collection of all predecessors of the given node

getSuccessors

Iterable<AgentType> getSuccessors(AgentType ego)
Parameters:
ego -
Returns:
iterable collection of all successors from the given node

isAdjacent

boolean isAdjacent(AgentType ego,
                   AgentType alter)
Parameters:
ego -
alter -
Returns:
true if the given nodes are adjacent to each other

isSuccessor

boolean isSuccessor(AgentType alter,
                    AgentType ego)
Checks whether there is a link from ego to alter.

Parameters:
ego -
alter -
Returns:
true, if alter (1st node) is a successor of ego (2nd node)

isDirected

boolean isDirected()
Returns:
true if this network is directed

getDegree

int getDegree(AgentType ego)
Parameters:
ego -
Returns:
the number of in- and outgoing edges (degree)

getInDegree

int getInDegree(AgentType ego)
Parameters:
ego -
Returns:
the number of incoming edges (in-degree)

getOutDegree

int getOutDegree(AgentType ego)
Parameters:
ego -
Returns:
the number of outgoing edges (out-degree)

getName

String getName()
Returns:
the network's name

getNodes

Iterable<AgentType> getNodes()
Returns:
the collection of all nodes

numEdges

int numEdges()
Returns:
the number of edges in this network

getEdge

EdgeType getEdge(AgentType source,
                 AgentType target)
Parameters:
source -
target -
Returns:

getEdgesCollection

Collection<EdgeType> getEdgesCollection()
Returns:
collection of all edges

numNodes

int numNodes()
Returns:
the number of nodes in this network

getJungGraph

Graph<AgentType,EdgeType> getJungGraph()
Return a JUNG Graph object of this network.

Returns:
a JUNG Graph object of this network

reverseNetwork

void reverseNetwork()
Returns a reversed network, i.e. for all edges source and target vertices are exchanged.


getNetworkBuilderClass

Class<? extends MoreNetworkBuilder<?,?>> getNetworkBuilderClass()

setNetworkBuilderClass

void setNetworkBuilderClass(Class<? extends MoreNetworkBuilder<?,?>> builderClass)

setEdgeFactory

void setEdgeFactory(MoreEdgeFactory<AgentType,EdgeType> edgeFac)
Sets the MoreEdgeFactory that is used to connect agents.

Parameters:
edgeFac -

getNetworkInfo

String getNetworkInfo()
Provides some basic oinformation on the network: - number of links - number of edges - directedness