Class FastDirectedWeightedMultiEdges
java.lang.Object
es.uam.eps.ir.relison.graph.multigraph.edges.fast.FastMultiEdges
es.uam.eps.ir.relison.graph.multigraph.edges.fast.FastDirectedWeightedMultiEdges
- All Implemented Interfaces:
DirectedMultiEdges
,MultiEdges
,WeightedMultiEdges
public class FastDirectedWeightedMultiEdges extends FastMultiEdges implements DirectedMultiEdges, WeightedMultiEdges
Fast implementation of directed 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 FastDirectedWeightedMultiEdges()
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<MultiEdgeTypes>
getAdjacentTypes(int node)
Gets the types of the adjacent edges of a node.java.util.stream.Stream<MultiEdgeWeights>
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<MultiEdgeTypes>
getIncidentTypes(int node)
Gets the types of the incident edges of a node.java.util.stream.Stream<MultiEdgeWeights>
getIncidentWeights(int node)
Gets the weights of the incident 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, int idx)
Removes an edge.boolean
removeEdges(int orig, int dest)
Removes all the edges between a pair of nodes.boolean
removeNode(int idx)
Removes a node from the edge list.boolean
updateEdgeType(int orig, int dest, int type, int idx)
Modifies the weight of an edge.boolean
updateEdgeWeight(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, 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.multigraph.edges.DirectedMultiEdges
getMutualNodes, getMutualTypes, getNeighbourCount, getNeighbourNodes, getNeighbourTypes
Methods inherited from interface es.uam.eps.ir.relison.graph.multigraph.edges.MultiEdges
addUser, containsEdge, getAdjacentCount, getEdgeTypes, getEdgeWeights, getIncidentCount, getIsolatedNodes, getNumEdges, getNumEdges, hasAdjacentEdges, hasEdges, hasIncidentEdges, hasMutualEdges
Methods inherited from interface es.uam.eps.ir.relison.graph.multigraph.edges.WeightedMultiEdges
getMutualWeights, getNeighbourWeights
-
Constructor Details
-
FastDirectedWeightedMultiEdges
public FastDirectedWeightedMultiEdges()Constructor.
-
-
Method Details
-
getIncidentNodes
public java.util.stream.Stream<java.lang.Integer> getIncidentNodes(int node)Description copied from interface:MultiEdges
Gets the incoming neighbourhood of a node.- Specified by:
getIncidentNodes
in interfaceMultiEdges
- 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:MultiEdges
Gets the outgoing neighbourhood of a node.- Specified by:
getAdjacentNodes
in interfaceMultiEdges
- Parameters:
node
- The node.- Returns:
- a stream containing all the ids of the nodes.
-
getIncidentTypes
Description copied from interface:MultiEdges
Gets the types of the incident edges of a node.- Specified by:
getIncidentTypes
in interfaceMultiEdges
- Parameters:
node
- The node.- Returns:
- a stream containing all the edge types.
-
getAdjacentTypes
Description copied from interface:MultiEdges
Gets the types of the adjacent edges of a node.- Specified by:
getAdjacentTypes
in interfaceMultiEdges
- Parameters:
node
- The node.- Returns:
- a stream containing all the edge types.
-
getIncidentWeights
Description copied from interface:MultiEdges
Gets the weights of the incident edges of a node.- Specified by:
getIncidentWeights
in interfaceMultiEdges
- Specified by:
getIncidentWeights
in interfaceWeightedMultiEdges
- Parameters:
node
- The node.- Returns:
- a stream containing all the edge types.
-
getAdjacentWeights
Description copied from interface:MultiEdges
Gets the weights of the adjacent edges of a node.- Specified by:
getAdjacentWeights
in interfaceMultiEdges
- Specified by:
getAdjacentWeights
in interfaceWeightedMultiEdges
- 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:MultiEdges
Adds an edge to the set.- Specified by:
addEdge
in interfaceMultiEdges
- Parameters:
orig
- Origin nodedest
- Destiny nodeweight
- Weight of the edgetype
- Type of the edge- Returns:
- true if everything went OK, false if not.
-
getNodesWithIncidentEdges
public java.util.stream.IntStream getNodesWithIncidentEdges()Description copied from interface:MultiEdges
Obtains the set of nodes which have incident edges.- Specified by:
getNodesWithIncidentEdges
in interfaceMultiEdges
- Returns:
- a stream containing the ids of nodes with incident edges
-
getNodesWithAdjacentEdges
public java.util.stream.IntStream getNodesWithAdjacentEdges()Description copied from interface:MultiEdges
Obtains the set of nodes which have adjacent edges.- Specified by:
getNodesWithAdjacentEdges
in interfaceMultiEdges
- Returns:
- a stream containing the ids of nodes with incident edges
-
getNodesWithEdges
public java.util.stream.IntStream getNodesWithEdges()Description copied from interface:MultiEdges
Obtains the set of nodes which have edges.- Specified by:
getNodesWithEdges
in interfaceMultiEdges
- Returns:
- a stream containing the ids of nodes with incident edges
-
getNodesWithMutualEdges
public java.util.stream.IntStream getNodesWithMutualEdges()Description copied from interface:MultiEdges
Obtains the set of nodes which have, at least, a reciprocal edge.- Specified by:
getNodesWithMutualEdges
in interfaceMultiEdges
- Returns:
- a stream containing the ids of nodes with reciprocal edges.
-
removeEdge
public boolean removeEdge(int orig, int dest, int idx)Description copied from interface:MultiEdges
Removes an edge.- Specified by:
removeEdge
in 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:MultiEdges
Removes a node from the edge list.- Specified by:
removeNode
in 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:MultiEdges
Removes all the edges between a pair of nodes.- Specified by:
removeEdges
in 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:MultiEdges
Modifies the weight of an edge.- Specified by:
updateEdgeWeight
in 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:MultiEdges
Modifies the weight of an edge.- Specified by:
updateEdgeType
in 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.
-