Interface Edges
- All Known Subinterfaces:
DirectedEdges
,UndirectedEdges
,UnweightedEdges
,WeightedEdges
- All Known Implementing Classes:
FastDirectedUnweightedEdges
,FastDirectedWeightedEdges
,FastEdges
,FastUndirectedUnweightedEdges
,FastUndirectedWeightedEdges
public interface Edges
Interface that represents the edges of a graph.
-
Method Summary
Modifier and Type Method Description boolean
addEdge(int orig, int dest, double weight, int type)
Adds an edge to the set.boolean
addUser(int idx)
Adds a user to the edges.boolean
containsEdge(int orig, int dest)
Checks if an edge exists.long
getAdjacentCount(int node)
Gets the number of adjacent nodes.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.int
getEdgeType(int orig, int dest)
Gets the type of an edge.double
getEdgeWeight(int orig, int dest)
Gets the weight of an edge.long
getIncidentCount(int node)
Gets the number of incident nodes.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.IntStream
getIsolatedNodes()
Obtains the set of nodes which do not have any neighbor.java.util.stream.Stream<EdgeType>
getMutualAdjacentTypes(int node)
Gets the types of the adjacent edges of a node, such that there is a reciprocal.java.util.stream.Stream<es.uam.eps.ir.ranksys.fast.preference.IdxPref>
getMutualAdjacentWeights(int node)
Gets the weights of the adjacent edges of a node which are reciprocated.long
getMutualCount(int node)
Gets the number of nodes which are, at the same time, adjacent and incident.java.util.stream.Stream<EdgeType>
getMutualIncidentTypes(int node)
Gets the types of the incident edges of a node, such that there is a reciprocal.java.util.stream.Stream<es.uam.eps.ir.ranksys.fast.preference.IdxPref>
getMutualIncidentWeights(int node)
Gets the weights of the incident edges of a node which are reciprocated.java.util.stream.Stream<java.lang.Integer>
getMutualNodes(int node)
Gets the neighbors of a node which are, at the same time, incident and adjacent.java.util.stream.Stream<EdgeType>
getMutualTypes(int node)
Gets the types of the neighbourhood edges of a node, such that there is a reciprocal.java.util.stream.Stream<es.uam.eps.ir.ranksys.fast.preference.IdxPref>
getMutualWeights(int node)
For each mutual connection (node to u and u to node exist in the graph), gets the average values of the incident and adjacent edge between u and the node.long
getNeighbourCount(int node)
Gets the number of neighbour nodes.java.util.stream.Stream<java.lang.Integer>
getNeighbourNodes(int node)
Gets the full neighbourhood of a node.java.util.stream.Stream<EdgeType>
getNeighbourTypes(int node)
Gets the types of the neighbourhood 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.long
getNumEdges()
Obtains the number of edges in the graph.boolean
hasAdjacentEdges(int idx)
Checks if a node has adjacent edges.boolean
hasEdges(int idx)
Checks if a node has adjacent or incident edges.boolean
hasIncidentEdges(int idx)
Checks if a node has incident edges.boolean
hasMutualEdges(int idx)
Checks if a node has mutual edges.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.
-
Method Details
-
containsEdge
boolean containsEdge(int orig, int dest)Checks if an edge exists.- Parameters:
orig
- The source endpoint.dest
- The incoming endpoint.- Returns:
- true if the edge exists, false if not.
-
getEdgeWeight
double getEdgeWeight(int orig, int dest)Gets the weight of an edge.- Parameters:
orig
- The source endpoint.dest
- The incoming endpoint.- Returns:
- the value if the edge exists, the default error value if not.
-
getEdgeType
int getEdgeType(int orig, int dest)Gets the type of an edge.- Parameters:
orig
- The source endpoint.dest
- The incoming endpoint.- Returns:
- the type if the edge exists, the default error value if not.
-
getIncidentNodes
java.util.stream.Stream<java.lang.Integer> getIncidentNodes(int node)Gets the incoming neighbourhood of a node.- Parameters:
node
- The node.- Returns:
- a stream of all the ids of nodes.
-
getAdjacentNodes
java.util.stream.Stream<java.lang.Integer> getAdjacentNodes(int node)Gets the outgoing neighbourhood of a node.- Parameters:
node
- The node.- Returns:
- a stream containing all the ids of the nodes.
-
getNeighbourNodes
java.util.stream.Stream<java.lang.Integer> getNeighbourNodes(int node)Gets the full neighbourhood of a node.- Parameters:
node
- The node.- Returns:
- a stream containing all the ids of the nodes.
-
getMutualNodes
java.util.stream.Stream<java.lang.Integer> getMutualNodes(int node)Gets the neighbors of a node which are, at the same time, incident and adjacent.- Parameters:
node
- The node.- Returns:
- a stream containing all the ids of the nodes.
-
getIncidentTypes
Gets the types of the incident edges of a node.- Parameters:
node
- The node.- Returns:
- a stream containing all the edge types.
-
getAdjacentTypes
Gets the types of the adjacent edges of a node.- Parameters:
node
- The node.- Returns:
- a stream containing all the edge types.
-
getNeighbourTypes
Gets the types of the neighbourhood edges of a node.- Parameters:
node
- The node.- Returns:
- a stream containing all the edge types.
-
getMutualAdjacentTypes
Gets the types of the adjacent edges of a node, such that there is a reciprocal. connection in the graph.- Parameters:
node
- The node.- Returns:
- a stream containing all the edge types.
-
getMutualIncidentTypes
Gets the types of the incident edges of a node, such that there is a reciprocal. connection in the graph.- Parameters:
node
- The node.- Returns:
- a stream containing all the edge types.
-
getMutualTypes
Gets the types of the neighbourhood edges of a node, such that there is a reciprocal. connection in the graph.- Parameters:
node
- The node.- Returns:
- a stream containing all the edge types.
-
getIncidentWeights
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.- Parameters:
node
- The node.- Returns:
- a stream containing all the edge types.
-
getAdjacentWeights
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.- Parameters:
node
- The node.- Returns:
- a stream containing all the edge types.
-
getNeighbourWeights
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.- Parameters:
node
- The node.- Returns:
- a sream containing all the edge types.
-
getMutualAdjacentWeights
java.util.stream.Stream<es.uam.eps.ir.ranksys.fast.preference.IdxPref> getMutualAdjacentWeights(int node)Gets the weights of the adjacent edges of a node which are reciprocated.- Parameters:
node
- The node.- Returns:
- a stream containing all the edge types.
-
getMutualIncidentWeights
java.util.stream.Stream<es.uam.eps.ir.ranksys.fast.preference.IdxPref> getMutualIncidentWeights(int node)Gets the weights of the incident edges of a node which are reciprocated.- Parameters:
node
- The node.- Returns:
- a stream containing all the edge types.
-
getMutualWeights
java.util.stream.Stream<es.uam.eps.ir.ranksys.fast.preference.IdxPref> getMutualWeights(int node)For each mutual connection (node to u and u to node exist in the graph), gets the average values of the incident and adjacent edge between u and the node.- Parameters:
node
- The node.- Returns:
- a stream containing all the edge types.
-
getAdjacentCount
long getAdjacentCount(int node)Gets the number of adjacent nodes.- Parameters:
node
- The node.- Returns:
- the number of adjacent nodes.
-
getIncidentCount
long getIncidentCount(int node)Gets the number of incident nodes.- Parameters:
node
- The node.- Returns:
- the number of incident nodes.
-
getNeighbourCount
long getNeighbourCount(int node)Gets the number of neighbour nodes.- Parameters:
node
- The node.- Returns:
- the number of neighbour nodes.
-
getMutualCount
long getMutualCount(int node)Gets the number of nodes which are, at the same time, adjacent and incident.- Parameters:
node
- The node.- Returns:
- the number of mutual neighbors.
-
addUser
boolean addUser(int idx)Adds a user to the edges.- Parameters:
idx
- Identifier of the user.- Returns:
- the user.
-
addEdge
boolean addEdge(int orig, int dest, double weight, int type)Adds an edge to the set.- Parameters:
orig
- Source node.dest
- Incoming node.weight
- Weight of the edge.type
- Type of the edge.- Returns:
- true if everything went OK, false if not.
-
removeEdge
boolean removeEdge(int orig, int dest)Removes an edge.- Parameters:
orig
- Source node.dest
- Incoming node.- Returns:
- true if everything went OK, false if not.
-
removeNode
boolean removeNode(int idx)Removes a node from the edge list.- Parameters:
idx
- The identifier of the node.- Returns:
- true if everything went OK, false otherwise.
-
updateEdgeWeight
boolean updateEdgeWeight(int orig, int dest, double weight)Modifies the weight of an edge.- 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
boolean updateEdgeType(int orig, int dest, int type)Modifies the weight of an edge.- 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.
-
getNumEdges
long getNumEdges()Obtains the number of edges in the graph.- Returns:
- the number of edges in the graph.
-
getIsolatedNodes
java.util.stream.IntStream getIsolatedNodes()Obtains the set of nodes which do not have any neighbor.- Returns:
- a stream containing the set of nodes which do not have neighbors.
-
getNodesWithIncidentEdges
java.util.stream.IntStream getNodesWithIncidentEdges()Obtains the set of nodes which have incident edges.- Returns:
- a stream containing the ids of nodes with incident edges.
-
getNodesWithAdjacentEdges
java.util.stream.IntStream getNodesWithAdjacentEdges()Obtains the set of nodes which have adjacent edges.- Returns:
- a stream containing the ids of nodes with incident edges.
-
getNodesWithEdges
java.util.stream.IntStream getNodesWithEdges()Obtains the set of nodes which have edges.- Returns:
- a stream containing the ids of nodes with incident edges.
-
getNodesWithMutualEdges
java.util.stream.IntStream getNodesWithMutualEdges()Obtains the set of nodes which have, at least, a reciprocal edge.- Returns:
- a stream containing the ids of nodes with reciprocal edges.
-
hasAdjacentEdges
boolean hasAdjacentEdges(int idx)Checks if a node has adjacent edges.- Parameters:
idx
- The identifier of the node.- Returns:
- true if it has adjacent edges, false otherwise.
-
hasIncidentEdges
boolean hasIncidentEdges(int idx)Checks if a node has incident edges.- Parameters:
idx
- The identifier of the node.- Returns:
- true if it has incident edges, false otherwise.
-
hasEdges
boolean hasEdges(int idx)Checks if a node has adjacent or incident edges.- Parameters:
idx
- The identifier of the node.- Returns:
- true if it has adjacent or incident edges, false otherwise.
-
hasMutualEdges
boolean hasMutualEdges(int idx)Checks if a node has mutual edges.- Parameters:
idx
- The identifier of the node.- Returns:
- true if it has mutual edges, false otherwise.
-