Class FastUndirectedWeightedMultiEdges
java.lang.Object
es.uam.eps.ir.relison.graph.multigraph.edges.fast.FastMultiEdges
es.uam.eps.ir.relison.graph.multigraph.edges.fast.FastUndirectedWeightedMultiEdges
- All Implemented Interfaces:
MultiEdges,UndirectedMultiEdges,WeightedMultiEdges
public class FastUndirectedWeightedMultiEdges extends FastMultiEdges implements UndirectedMultiEdges, WeightedMultiEdges
Fast implementation of undirected weighted edges for multigraphs.
-
Field Summary
Fields inherited from class es.uam.eps.ir.relison.graph.multigraph.edges.fast.FastMultiEdges
numEdges, types, weights -
Constructor Summary
Constructors Constructor Description FastUndirectedWeightedMultiEdges()Constructor. -
Method Summary
Modifier and Type Method Description booleanaddEdge(int orig, int dest, double weight, int type)Adds an edge to the set.java.util.stream.Stream<java.lang.Integer>getNeighbourNodes(int node)Gets the full neighbourhood of a node.java.util.stream.Stream<MultiEdgeTypes>getNeighbourTypes(int node)Gets the types of the neighbourhood edges of a node.java.util.stream.Stream<MultiEdgeWeights>getNeighbourWeights(int node)Gets the weights of the neighbour edges of a node.java.util.stream.IntStreamgetNodesWithEdges()Obtains the set of nodes which have edges.booleanremoveEdge(int orig, int dest, int idx)Removes an edge.booleanremoveEdges(int orig, int dest)Removes all the edges between a pair of nodes.booleanremoveNode(int idx)Removes a node from the edge list.booleanupdateEdgeType(int orig, int dest, int type, int idx)Modifies the weight of an edge.booleanupdateEdgeWeight(int orig, int dest, double weight, int idx)Modifies the weight of an edge.Methods inherited from class es.uam.eps.ir.relison.graph.multigraph.edges.fast.FastMultiEdges
addUser, containsEdge, getAdjacentCount, getEdgeTypes, getEdgeWeights, getIncidentCount, getIsolatedNodes, getNumEdges, getNumEdges, hasAdjacentEdges, hasEdges, hasIncidentEdges, hasMutualEdgesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface es.uam.eps.ir.relison.graph.multigraph.edges.MultiEdges
addUser, containsEdge, getAdjacentCount, getEdgeTypes, getEdgeWeights, getIncidentCount, getIsolatedNodes, getNumEdges, getNumEdges, hasAdjacentEdges, hasEdges, hasIncidentEdges, hasMutualEdgesMethods inherited from interface es.uam.eps.ir.relison.graph.multigraph.edges.UndirectedMultiEdges
getAdjacentNodes, getAdjacentTypes, getIncidentNodes, getIncidentTypes, getMutualNodes, getMutualTypes, getNeighbourCount, getNodesWithAdjacentEdges, getNodesWithIncidentEdges, getNodesWithMutualEdgesMethods inherited from interface es.uam.eps.ir.relison.graph.multigraph.edges.WeightedMultiEdges
getAdjacentWeights, getIncidentWeights, getMutualWeights
-
Constructor Details
-
FastUndirectedWeightedMultiEdges
public FastUndirectedWeightedMultiEdges()Constructor.
-
-
Method Details
-
getNeighbourNodes
public java.util.stream.Stream<java.lang.Integer> getNeighbourNodes(int node)Description copied from interface:MultiEdgesGets the full neighbourhood of a node.- Specified by:
getNeighbourNodesin interfaceMultiEdges- Parameters:
node- The node.- Returns:
- a stream containing all the ids of the nodes.
-
getNeighbourTypes
Description copied from interface:MultiEdgesGets the types of the neighbourhood edges of a node.- Specified by:
getNeighbourTypesin interfaceMultiEdges- Parameters:
node- The node.- Returns:
- a stream containing all the edge types.
-
getNeighbourWeights
Description copied from interface:MultiEdgesGets the weights of the neighbour edges of a node.- Specified by:
getNeighbourWeightsin interfaceMultiEdges- Specified by:
getNeighbourWeightsin interfaceWeightedMultiEdges- Parameters:
node- The node.- Returns:
- a sream containing all the edge types.
-
addEdge
public boolean addEdge(int orig, int dest, double weight, int type)Description copied from interface:MultiEdgesAdds an edge to the set.- Specified by:
addEdgein interfaceMultiEdges- Parameters:
orig- Origin nodedest- Destiny nodeweight- Weight of the edgetype- Type of the edge- Returns:
- true if everything went OK, false if not.
-
getNodesWithEdges
public java.util.stream.IntStream getNodesWithEdges()Description copied from interface:MultiEdgesObtains the set of nodes which have edges.- Specified by:
getNodesWithEdgesin interfaceMultiEdges- Returns:
- a stream containing the ids of nodes with incident edges
-
removeEdge
public boolean removeEdge(int orig, int dest, int idx)Description copied from interface:MultiEdgesRemoves an edge.- Specified by:
removeEdgein interfaceMultiEdges- Parameters:
orig- source node.dest- incoming node.idx- the number of the edge- Returns:
- true if everything went OK, false if not.
-
removeNode
public boolean removeNode(int idx)Description copied from interface:MultiEdgesRemoves a node from the edge list.- Specified by:
removeNodein interfaceMultiEdges- Parameters:
idx- the identifier of the node.- Returns:
- true if everything went OK, false otherwise.
-
removeEdges
public boolean removeEdges(int orig, int dest)Description copied from interface:MultiEdgesRemoves all the edges between a pair of nodes.- Specified by:
removeEdgesin interfaceMultiEdges- Parameters:
orig- source node.dest- incoming node.- Returns:
- true if everything went OK, false otherwise.
-
updateEdgeWeight
public boolean updateEdgeWeight(int orig, int dest, double weight, int idx)Description copied from interface:MultiEdgesModifies the weight of an edge.- Specified by:
updateEdgeWeightin interfaceMultiEdges- Parameters:
orig- source node.dest- incoming node.weight- the new weight of the edge.idx- the number of the edge.- Returns:
- true if everything went OK, false if not, or the edge does not exist.
-
updateEdgeType
public boolean updateEdgeType(int orig, int dest, int type, int idx)Description copied from interface:MultiEdgesModifies the weight of an edge.- Specified by:
updateEdgeTypein interfaceMultiEdges- Parameters:
orig- source node.dest- incoming node.type- the new type of the edge.idx- the number of the edge.- Returns:
- true if everything went OK, false if not, or the edge does not exist.
-