Package repast.simphony.space.graph
Interface Network<T>
- All Superinterfaces:
- Projection<T>
- All Known Implementing Classes:
- ContextJungNetwork,- DirectedJungNetwork,- JungNetwork,- UndirectedJungNetwork
Interface for Network projections.
- Version:
- $Revision$ $Date$
- Author:
- Nick Collier
- 
Method SummaryModifier and TypeMethodDescriptionaddEdge(RepastEdge<T> edge) Adds the specified edge to this Network.Adds an edge between the specified objects.Adds an edge between the specified objects.booleancontainsEdge(RepastEdge<T> edge) Returns whether or not this network contains the specified edge.getAdjacent(T agent) Gets any objects that are adjacent to this object.intGet the total degree (number of edges) for the graph.intGets the degree of the node associated with the specified object.Retrieves the edge between the specified source and target.EdgeCreator<? extends RepastEdge<T>,T> Gets the EdgeCreator used to create edges for this Network.getEdges()Gets all the edges in this Network.Gets all the edges where the specified object is a source or a target.intgetInDegree(T agent) Gets the in degree of the node associated with the specified object.getInEdges(T agent) Gets all the in-edges for the specified object.getNodes()Gets an iterator over all the agent nodes in this network.intgetOutDegree(T agent) Gets the out degree of the node associated with the specified object.getOutEdges(T agent) Gets all the out-edges for the specified object.getPredecessors(T agent) Gets the predecessors of the specified object.getRandomAdjacent(T agent) Gets a random object that is adjacent to the specified object.getRandomPredecessor(T agent) Get a random predecessor of the specified object.getRandomSuccessor(T agent) Gets a random successor of the specified object.getSuccessors(T agent) Gets the successors of the specified object.booleanisAdjacent(T first, T second) Returns true if the first object is adjacent to the second.booleanbooleanisPredecessor(T first, T second) Returns true if the first object is a predecessor of the second.booleanisSuccessor(T first, T second) Returns true if the first object is a successor of the second.intnumEdges()Gets the number of edges in this Network.voidremoveEdge(RepastEdge<T> edge) Removes the specified edge from this Network.voidMethod removes all edges in the given network.intsize()Gets the number of nodes in this network.Methods inherited from interface repast.simphony.space.projection.ProjectionaddProjectionListener, evaluate, getName, getProjectionListeners, removeProjectionListener
- 
Method Details- 
isDirectedboolean isDirected()- Returns:
- true if this Network is directed, otherwise false.
 
- 
getEdgeCreatorEdgeCreator<? extends RepastEdge<T>,T> getEdgeCreator()Gets the EdgeCreator used to create edges for this Network.addEdgeandaddEdgewill use this creator to create edges. Any edge added withaddEdgemust be of the same type as that created with this EdgeCreator. By default, an edge creator that creates RepastEdges is used. The default EdgeCreator will create RepastEdge- Returns:
- the edge class of this network
 
- 
addEdgeAdds an edge between the specified objects.- Parameters:
- source- the source object
- target- the target object
- Returns:
- the created edge.
 
- 
addEdgeAdds an edge between the specified objects.- Parameters:
- source- the source object
- target- the target object
- weight- weight of the new edge
- Returns:
- the created edge.
 
- 
addEdgeAdds the specified edge to this Network. This will change the directionality of the edge to met that of the network.- Parameters:
- edge- the edge to add.
- Returns:
- the added edge.
 
- 
getEdgeRetrieves the edge between the specified source and target. If multiple edges exist between these two objects, the first found will be returned.- Parameters:
- source- the source of the edge
- target- the target of the edge
- Returns:
- an edge or null if no such edge exists
 
- 
removeEdgeRemoves the specified edge from this Network.- Parameters:
- edge- the edge to remove
 
- 
containsEdgeReturns whether or not this network contains the specified edge.- Parameters:
- edge- the edge to check
- Returns:
- true if the network contains the specified edge, otherwise false.
 
- 
sizeint size()Gets the number of nodes in this network.- Returns:
- the number of nodes in this network.
 
- 
numEdgesint numEdges()Gets the number of edges in this Network.- Returns:
- the number of edges in this Network.
 
- 
getPredecessorsGets the predecessors of the specified object. If the network is directed then the predecessors are any objects connected to the specified object by an edge where the specified object is the target of that edge. If the network is undirected, then this returns any object connected to the specified object.- Parameters:
- agent- the object whose predecessors should be returned
- Returns:
- an iterator over the predecessors of the specified object.
 
- 
getSuccessorsGets the successors of the specified object. If the network is directed then the successors are any objects connected to the specified object by an edge where the specified object is the source of that edge. If the network is undirected, then this returns any object connected to the specified object.- Parameters:
- agent- the object whose successors should be returned
- Returns:
- an iterator over the successors of the specified object.
 
- 
getAdjacentGets any objects that are adjacent to this object. An object is adjacent if it has an edge either from or to the specified object.- Parameters:
- agent- the object whose adjacent objects should be returned
- Returns:
- an iterator over all the objects adjacent to the specified object.
 
- 
getRandomPredecessorGet a random predecessor of the specified object. If the network is directed then the predecessors are any objects connected to the specified object by an edge where the specified object is the target of that edge. If the network is undirected, then a predecessor can be any object connected to the specified object.- Parameters:
- agent-
- Returns:
- a random predecessor of the specified object or null if there are no predecessors.
 
- 
getRandomSuccessorGets a random successor of the specified object. If the network is directed then the successors are any objects connected to the specified object by an edge where the specified object is the source of that edge. If the network is undirected, then a successor can be any object connected to the specified object.- Parameters:
- agent-
- Returns:
- a random predecessor of the specified object or null if there are no successors.
 
- 
getRandomAdjacentGets a random object that is adjacent to the specified object.- Parameters:
- agent-
- Returns:
- a random object that is adjacent to the specified object or null if no objects are adjacent.
 
- 
isPredecessorReturns true if the first object is a predecessor of the second. If the network is directed then the predecessors are any objects connected to the specified object by an edge where the specified object is the target of that edge. If the network is undirected, then a predecessor can be any object connected to the specified object.- Parameters:
- first-
- second-
- Returns:
- true if the first object is a predecessor of the second.
 
- 
isSuccessorReturns true if the first object is a successor of the second. If the network is directed then the successors are any objects connected to the specified object by an edge where the specified object is the source of that edge. If the network is undirected, then a successor can be any object connected to the specified object.- Parameters:
- first-
- second-
- Returns:
- true if the first object is a successor of the second.
 
- 
isAdjacentReturns true if the first object is adjacent to the second. An object is adjacent to another if there is an edge between the first object and the second, regardeless of the edges directionality.- Parameters:
- first-
- second-
- Returns:
- true if the first object is a adjacent to the second.
 
- 
getDegreeGets the degree of the node associated with the specified object.- Parameters:
- agent- the object whose node's degree we want.
- Returns:
- the degree of the node associated with the specified object.
 
- 
getInEdgesGets all the in-edges for the specified object. In a directed network an in edge is any edge where the specified object is the target. In an undirected network, edges are both in- and out-, and so all edges are returned.- Parameters:
- agent- the object whose in-edges should be returned
- Returns:
- an iterator over all the in-edges for the specified object.
 
- 
getOutEdgesGets all the out-edges for the specified object. In a directed network an out edge is any edge where the specified object is the source. In an undirected network, edges are both in- and out-, and so all edges are returned.- Parameters:
- agent- the object whose out-edges should be returned
- Returns:
- an iterator over all the out-edges for the specified object.
 
- 
getEdgesGets all the edges where the specified object is a source or a target.- Parameters:
- agent- the object whose edges should be returned
- Returns:
- an iterator over all the edges where the specified object is a source or a target.
 
- 
getEdgesIterable<RepastEdge<T>> getEdges()Gets all the edges in this Network.- Returns:
- an iterator over all the edges in this Network.
 
- 
getNodesGets an iterator over all the agent nodes in this network.- Returns:
- an iterator over all the agent nodes in this network.
 
- 
getInDegreeGets the in degree of the node associated with the specified object.- Parameters:
- agent- the object whose node's in degree we want.
- Returns:
- the in degree of the node associated with the specified object.
 
- 
getOutDegreeGets the out degree of the node associated with the specified object.- Parameters:
- agent- the object whose node's out degree we want.
- Returns:
- the out degree of the node associated with the specified object.
 
- 
getDegreeint getDegree()Get the total degree (number of edges) for the graph.- Returns:
- the total degree (number of edges) for the graph.
 
- 
removeEdgesvoid removeEdges()Method removes all edges in the given network.
 
-