Class FastDirectedWeightedEdges
java.lang.Object
es.uam.eps.ir.relison.graph.edges.fast.FastEdges
es.uam.eps.ir.relison.graph.edges.fast.FastDirectedWeightedEdges
- All Implemented Interfaces:
DirectedEdges
,Edges
,WeightedEdges
public class FastDirectedWeightedEdges extends FastEdges implements DirectedEdges, WeightedEdges
Fast implementation of directed weighted edges.
-
Field Summary
-
Constructor Summary
Constructors Constructor Description FastDirectedWeightedEdges()
Constructor. -
Method Summary
Modifier and Type Method Description boolean
addEdge(int orig, int dest, double weight, int type)
Adds an edge to the set.java.util.stream.Stream<java.lang.Integer>
getAdjacentNodes(int node)
Gets the outgoing neighbourhood of a node.java.util.stream.Stream<EdgeType>
getAdjacentTypes(int node)
Gets the types of the adjacent edges of a node.java.util.stream.Stream<es.uam.eps.ir.ranksys.fast.preference.IdxPref>
getAdjacentWeights(int node)
Gets the weights of the adjacent edges of a node.java.util.stream.Stream<java.lang.Integer>
getIncidentNodes(int node)
Gets the incoming neighbourhood of a node.java.util.stream.Stream<EdgeType>
getIncidentTypes(int node)
Gets the types of the incident edges of a node.java.util.stream.Stream<es.uam.eps.ir.ranksys.fast.preference.IdxPref>
getIncidentWeights(int node)
Gets the weights of the incident edges of a node.java.util.stream.Stream<es.uam.eps.ir.ranksys.fast.preference.IdxPref>
getNeighbourWeights(int node)
Gets the weights of the neighbour edges of a node.java.util.stream.IntStream
getNodesWithAdjacentEdges()
Obtains the set of nodes which have adjacent edges.java.util.stream.IntStream
getNodesWithEdges()
Obtains the set of nodes which have edges.java.util.stream.IntStream
getNodesWithIncidentEdges()
Obtains the set of nodes which have incident edges.java.util.stream.IntStream
getNodesWithMutualEdges()
Obtains the set of nodes which have, at least, a reciprocal edge.boolean
removeEdge(int orig, int dest)
Removes an edge.boolean
removeNode(int idx)
Removes a node from the edge list.boolean
updateEdgeType(int orig, int dest, int type)
Modifies the weight of an edge.boolean
updateEdgeWeight(int orig, int dest, double weight)
Modifies the weight of an edge.Methods inherited from class es.uam.eps.ir.relison.graph.edges.fast.FastEdges
addUser, containsEdge, getAdjacentCount, getEdgeType, getEdgeWeight, getIncidentCount, getIsolatedNodes, getMutualCount, getNeighbourCount, getNumEdges, hasAdjacentEdges, hasEdges, hasIncidentEdges, hasMutualEdges
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface es.uam.eps.ir.relison.graph.edges.DirectedEdges
getMutualAdjacentTypes, getMutualAdjacentWeights, getMutualIncidentTypes, getMutualIncidentWeights, getMutualNodes, getMutualTypes, getMutualWeights, getNeighbourNodes, getNeighbourTypes
Methods inherited from interface es.uam.eps.ir.relison.graph.edges.Edges
addUser, containsEdge, getAdjacentCount, getEdgeType, getEdgeWeight, getIncidentCount, getIsolatedNodes, getMutualCount, getNeighbourCount, getNumEdges, hasAdjacentEdges, hasEdges, hasIncidentEdges, hasMutualEdges
-
Constructor Details
-
FastDirectedWeightedEdges
public FastDirectedWeightedEdges()Constructor.
-
-
Method Details
-
getIncidentNodes
public java.util.stream.Stream<java.lang.Integer> getIncidentNodes(int node)Description copied from interface:Edges
Gets the incoming neighbourhood of a node.- Specified by:
getIncidentNodes
in interfaceEdges
- Parameters:
node
- The node.- Returns:
- a stream of all the ids of nodes.
-
getAdjacentNodes
public java.util.stream.Stream<java.lang.Integer> getAdjacentNodes(int node)Description copied from interface:Edges
Gets the outgoing neighbourhood of a node.- Specified by:
getAdjacentNodes
in interfaceEdges
- Parameters:
node
- The node.- Returns:
- a stream containing all the ids of the nodes.
-
getIncidentTypes
Description copied from interface:Edges
Gets the types of the incident edges of a node.- Specified by:
getIncidentTypes
in interfaceEdges
- Parameters:
node
- The node.- Returns:
- a stream containing all the edge types.
-
getAdjacentTypes
Description copied from interface:Edges
Gets the types of the adjacent edges of a node.- Specified by:
getAdjacentTypes
in interfaceEdges
- Parameters:
node
- The node.- Returns:
- a stream containing all the edge types.
-
getIncidentWeights
public java.util.stream.Stream<es.uam.eps.ir.ranksys.fast.preference.IdxPref> getIncidentWeights(int node)Description copied from interface:Edges
Gets the weights of the incident edges of a node.- Specified by:
getIncidentWeights
in interfaceEdges
- Specified by:
getIncidentWeights
in interfaceWeightedEdges
- Parameters:
node
- The node.- Returns:
- a stream containing all the edge types.
-
getAdjacentWeights
public java.util.stream.Stream<es.uam.eps.ir.ranksys.fast.preference.IdxPref> getAdjacentWeights(int node)Description copied from interface:Edges
Gets the weights of the adjacent edges of a node.- Specified by:
getAdjacentWeights
in interfaceEdges
- Specified by:
getAdjacentWeights
in interfaceWeightedEdges
- Parameters:
node
- The node.- Returns:
- a stream containing all the edge types.
-
addEdge
public boolean addEdge(int orig, int dest, double weight, int type)Description copied from interface:Edges
Adds an edge to the set. -
updateEdgeWeight
public boolean updateEdgeWeight(int orig, int dest, double weight)Description copied from interface:Edges
Modifies the weight of an edge.- Specified by:
updateEdgeWeight
in interfaceEdges
- Parameters:
orig
- Source node.dest
- Incoming node.weight
- The new weight 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)Description copied from interface:Edges
Modifies the weight of an edge.- Specified by:
updateEdgeType
in interfaceEdges
- Parameters:
orig
- Source node.dest
- Incoming node.type
- The new weight of the edge.- Returns:
- true if everything went OK, false if not, or the edge does not exist.
-
getNeighbourWeights
public java.util.stream.Stream<es.uam.eps.ir.ranksys.fast.preference.IdxPref> getNeighbourWeights(int node)Description copied from interface:Edges
Gets the weights of the neighbour edges of a node.- Specified by:
getNeighbourWeights
in interfaceDirectedEdges
- Specified by:
getNeighbourWeights
in interfaceEdges
- Specified by:
getNeighbourWeights
in interfaceWeightedEdges
- Parameters:
node
- The node.- Returns:
- a sream containing all the edge types.
-
removeNode
public boolean removeNode(int idx)Description copied from interface:Edges
Removes a node from the edge list.- Specified by:
removeNode
in interfaceEdges
- Parameters:
idx
- The identifier of the node.- Returns:
- true if everything went OK, false otherwise.
-
removeEdge
public boolean removeEdge(int orig, int dest)Description copied from interface:Edges
Removes an edge.- Specified by:
removeEdge
in interfaceEdges
- Parameters:
orig
- Source node.dest
- Incoming node.- Returns:
- true if everything went OK, false if not.
-
getNodesWithIncidentEdges
public java.util.stream.IntStream getNodesWithIncidentEdges()Description copied from interface:Edges
Obtains the set of nodes which have incident edges.- Specified by:
getNodesWithIncidentEdges
in interfaceEdges
- Returns:
- a stream containing the ids of nodes with incident edges.
-
getNodesWithAdjacentEdges
public java.util.stream.IntStream getNodesWithAdjacentEdges()Description copied from interface:Edges
Obtains the set of nodes which have adjacent edges.- Specified by:
getNodesWithAdjacentEdges
in interfaceEdges
- Returns:
- a stream containing the ids of nodes with incident edges.
-
getNodesWithEdges
public java.util.stream.IntStream getNodesWithEdges()Description copied from interface:Edges
Obtains the set of nodes which have edges.- Specified by:
getNodesWithEdges
in interfaceEdges
- Returns:
- a stream containing the ids of nodes with incident edges.
-
getNodesWithMutualEdges
public java.util.stream.IntStream getNodesWithMutualEdges()Description copied from interface:Edges
Obtains the set of nodes which have, at least, a reciprocal edge.- Specified by:
getNodesWithMutualEdges
in interfaceEdges
- Returns:
- a stream containing the ids of nodes with reciprocal edges.
-