public abstract class SocialGraph extends SimulationEntity
Modifier and Type | Class and Description |
---|---|
static class |
SocialGraph.EDGEMEDIUM |
Modifier and Type | Field and Description |
---|---|
protected java.util.Set<SNEdge> |
edges |
protected java.util.EnumMap<SocialGraph.EDGEMEDIUM,java.util.HashMap<SNNode,java.util.Set<SNNode>>> |
neighbours |
protected java.util.Set<SNNode> |
nodes |
protected java.util.HashMap<SNNode,java.util.Set<SNEdge>> |
outgoingEdges |
protected java.util.EnumMap<SocialGraph.EDGEMEDIUM,java.util.HashMap<SNNode,java.util.Set<SNEdge>>> |
outgoingEdgesMedium |
associatedSimulationContainer
Constructor and Description |
---|
SocialGraph(SimulationContainer associatedSimulationContainer,
SNConfiguration sNConfiguration,
int numberOfNodes)
The SocialGraph is a directed graph describing the structure of interactions (corresponding to the edges) of
ConsumerAgents (corresponding to the nodes) with a given semantics (corresponding to the edge mediums).
|
SocialGraph(SimulationContainer associatedSimulationContainer,
SNConfiguration sNConfiguration,
java.util.Set<SNNode> initialNodes)
The SocialGraph is a directed graph describing the structure of interactions (corresponding to the edges) of
ConsumerAgents (corresponding to the nodes) with a given semantics (corresponding to the edge mediums).
|
SocialGraph(SimulationContainer associatedSimulationContainer,
SNConfiguration sNConfiguration,
java.util.Set<SNNode> nodes,
java.util.Set<SNEdge> edges,
java.util.EnumMap<SocialGraph.EDGEMEDIUM,java.util.HashMap<SNNode,java.util.Set<SNNode>>> neighbours)
The SocialGraph is a directed graph describing the structure of interactions (corresponding to the edges) of
ConsumerAgents (corresponding to the nodes) with a given semantics (corresponding to the edge mediums).
|
Modifier and Type | Method and Description |
---|---|
void |
addEdge(SNEdge edgeToAdd)
Method to add an edge to the SocialGraph
|
void |
addIsolatedNode(SNNode nodeToAdd)
Adds a node to the SocialGraph without introducing any edges involving this node.
|
void |
addNodes(SNConfiguration sNconfiguration,
java.util.Set<SNNode> nodesToAdd)
(Network type specific) method to add a number of nodes (and the edges that go with them) to the social graph
|
protected abstract java.util.Set<SNEdge> |
createEdges(SNConfiguration sNConfiguration,
java.util.Set<SNNode> initialNodes)
(Network type specific) method to generate edges between a set of initial nodes.
|
java.util.Set<SNNode> |
getAllMediaNeighbours(SNNode nodeOfInterest)
Method to get all nodes that are neighbours of a nodeOfInterest through any medium
|
java.util.Set<SNEdge> |
getEdges() |
java.util.EnumMap<SocialGraph.EDGEMEDIUM,java.util.HashMap<SNNode,java.util.Set<SNNode>>> |
getNeighbours() |
java.util.EnumMap<SocialGraph.EDGEMEDIUM,java.util.Set<SNNode>> |
getNeighbours(SNNode node)
Method deriving all nodes the node of interest has an edge towards by the medium of interest
|
java.util.Set<SNNode> |
getNeighbours(SNNode node,
SocialGraph.EDGEMEDIUM medium)
Method to derive all nodes the node of interest has an edge towards via the specified medium
|
java.util.HashMap<SNNode,java.util.Set<SNNode>> |
getNeighbours(SocialGraph.EDGEMEDIUM edgemedium) |
java.util.Set<SNNode> |
getNodes() |
void |
modifyEdgeMedium(SNEdge edgeToModify,
SocialGraph.EDGEMEDIUM newMedium)
Method to change the target node of an edge as long as no edge structurally equivalent to the new edge exists yet
(i.e.
|
void |
modifyEdgeNodes(SNEdge edgeToModify,
SNNode newSource,
SNNode newTarget)
Method to change the target node of an edge as long as no edge structurally equivalent to the new edge exists yet
(i.e.
|
void |
modifyEdgeSource(SNEdge edgeToModify,
SNNode newSource)
Method to change the source node of an edge as long as no edge structurally equivalent to the new edge exists yet
(i.e.
|
void |
modifyEdgeTarget(SNEdge edgeToModify,
SNNode newTarget)
Method to change the target node of an edge as long as no edge structurally equivalent to the new edge exists yet
(i.e.
|
void |
removeEdge(SNEdge edgeToRemove)
Removes the given edge from the SocialGraph
|
void |
replaceEdge(SNEdge edgeToReplace,
SNEdge replacingEdge)
Replaces an edge in the SocialGraph with another edge in the graph.
|
java.util.Set<SNEdge> |
retrieveAllEdges(SNNode sourceNode,
SNNode targetNode)
Method to retrieve all edges (of any medium) between the sourceNode and the targetNode.
|
SNEdge |
retrieveEdge(SNNode sourceNode,
SNNode targetNode,
SocialGraph.EDGEMEDIUM respectiveMedium)
Retrieves the edge between the sourceNode and the targetNode of the respectiveMedium.
|
getAssociatedSimulationContainer
protected java.util.Set<SNNode> nodes
protected java.util.Set<SNEdge> edges
protected java.util.EnumMap<SocialGraph.EDGEMEDIUM,java.util.HashMap<SNNode,java.util.Set<SNNode>>> neighbours
protected java.util.EnumMap<SocialGraph.EDGEMEDIUM,java.util.HashMap<SNNode,java.util.Set<SNEdge>>> outgoingEdgesMedium
public SocialGraph(SimulationContainer associatedSimulationContainer, SNConfiguration sNConfiguration, java.util.Set<SNNode> nodes, java.util.Set<SNEdge> edges, java.util.EnumMap<SocialGraph.EDGEMEDIUM,java.util.HashMap<SNNode,java.util.Set<SNNode>>> neighbours)
associatedSimulationContainer
- The container the social network is situated insNConfiguration
- The configuration object of the corresponding instance of SocialGraphnodes
- The nodes in the SocialGraphedges
- The edge in the SocialGraphneighbours
- The neighbourhood relations of the SocialGraphpublic SocialGraph(SimulationContainer associatedSimulationContainer, SNConfiguration sNConfiguration, java.util.Set<SNNode> initialNodes)
associatedSimulationContainer
- The container the social network is situated insNConfiguration
- The configuration object of the corresponding instance of SocialGraphinitialNodes
- The nodes the SocialGraph is based onpublic SocialGraph(SimulationContainer associatedSimulationContainer, SNConfiguration sNConfiguration, int numberOfNodes) throws java.lang.IllegalArgumentException
associatedSimulationContainer
- The container the social network is situated insNConfiguration
- The configuration object of the corresponding instance of SocialGraphnumberOfNodes
- The number of nodes the SocialGraph is to be initialized withjava.lang.IllegalArgumentException
- Will be thrown when the number of nodes to add is negativepublic java.util.Set<SNNode> getNodes()
public java.util.Set<SNEdge> getEdges()
public java.util.EnumMap<SocialGraph.EDGEMEDIUM,java.util.HashMap<SNNode,java.util.Set<SNNode>>> getNeighbours()
public java.util.HashMap<SNNode,java.util.Set<SNNode>> getNeighbours(SocialGraph.EDGEMEDIUM edgemedium)
public void addIsolatedNode(SNNode nodeToAdd) throws java.lang.IllegalArgumentException
nodeToAdd
- The node to add to the graphjava.lang.IllegalArgumentException
- Will be thrown when the node to add is already part of the SocialGraphpublic void addEdge(SNEdge edgeToAdd) throws java.lang.IllegalArgumentException
edgeToAdd
- The edge to add to the graphjava.lang.IllegalArgumentException
public java.util.Set<SNNode> getAllMediaNeighbours(SNNode nodeOfInterest)
nodeOfInterest
- The node whose neighbours are to be derivedpublic void removeEdge(SNEdge edgeToRemove) throws java.lang.IllegalArgumentException
edgeToRemove
- The edge to remove from the graphjava.lang.IllegalArgumentException
- Will be thrown when the edge is not part of the graphpublic void replaceEdge(SNEdge edgeToReplace, SNEdge replacingEdge) throws java.lang.IllegalArgumentException
edgeToReplace
- The edge in the graph that is replacedreplacingEdge
- The edge in the graph that replaces the respective edgejava.lang.IllegalArgumentException
- Will be thrown when either the edgeToReplace is not part of the graph or the replacingEdge already ispublic void modifyEdgeSource(SNEdge edgeToModify, SNNode newSource) throws java.lang.IllegalArgumentException
edgeToModify
- The edge that is to be changednewSource
- The node the new edge is to be pointing fromjava.lang.IllegalArgumentException
- Will be thrown when the edge that is changed or the new target node is not part of the social graph, or when the edge has no medium associated to it.public void modifyEdgeTarget(SNEdge edgeToModify, SNNode newTarget) throws java.lang.IllegalArgumentException
edgeToModify
- The edge that is to be changednewTarget
- The node the new edge is to be pointing towardsjava.lang.IllegalArgumentException
- Will be thrown when the edge that is changed or the new target node is not part of the social graph, or when the edge has no medium associated to it.public void modifyEdgeNodes(SNEdge edgeToModify, SNNode newSource, SNNode newTarget) throws java.lang.IllegalArgumentException
edgeToModify
- The edge that is to be changednewSource
- The node the new edge is to be pointing fromnewTarget
- The node the new edge is to be pointing towardsjava.lang.IllegalArgumentException
- Will be thrown when the edge that is changed or the new target node is not part of the social graph, or when the edge has no medium associated to it.public void modifyEdgeMedium(SNEdge edgeToModify, SocialGraph.EDGEMEDIUM newMedium) throws java.lang.IllegalArgumentException
edgeToModify
- The edge that is to be changednewMedium
- The medium the edge should be ofjava.lang.IllegalArgumentException
- Will be thrown when the edge that is changed or the new target node is not part of the social graph, or when the edge has no medium associated to it.public SNEdge retrieveEdge(SNNode sourceNode, SNNode targetNode, SocialGraph.EDGEMEDIUM respectiveMedium) throws java.lang.IllegalArgumentException
sourceNode
- The node the edge directs fromtargetNode
- The node the edge directs towardsrespectiveMedium
- The medium of the edgejava.lang.IllegalArgumentException
- Will be thrown when the respective edge doesn't existpublic java.util.Set<SNEdge> retrieveAllEdges(SNNode sourceNode, SNNode targetNode)
sourceNode
- The node from which the edges stem fromtargetNode
- The node the edges are directed topublic java.util.EnumMap<SocialGraph.EDGEMEDIUM,java.util.Set<SNNode>> getNeighbours(SNNode node)
node
- The node whose neighbour relation is to be derivedpublic java.util.Set<SNNode> getNeighbours(SNNode node, SocialGraph.EDGEMEDIUM medium)
node
- The node whose neighbours to derivemedium
- The medium via which the neighbours are to be derivedpublic void addNodes(SNConfiguration sNconfiguration, java.util.Set<SNNode> nodesToAdd) throws java.lang.IllegalArgumentException, java.lang.UnsupportedOperationException
sNconfiguration
- The configuration the social graph is based onnodesToAdd
- The nodes to be added to the social graphjava.lang.IllegalArgumentException
java.lang.UnsupportedOperationException
protected abstract java.util.Set<SNEdge> createEdges(SNConfiguration sNConfiguration, java.util.Set<SNNode> initialNodes) throws java.lang.IllegalArgumentException
sNConfiguration
- The configuration of the social graph of interestinitialNodes
- The nodes the social graph should be initialized withjava.lang.IllegalArgumentException
- Will be thrown when the configuration is errornous