Interface MultiEdges
- All Known Subinterfaces:
DirectedMultiEdges,UndirectedMultiEdges,UnweightedMultiEdges,WeightedMultiEdges
- All Known Implementing Classes:
FastDirectedUnweightedMultiEdges,FastDirectedWeightedMultiEdges,FastMultiEdges,FastUndirectedUnweightedMultiEdges,FastUndirectedWeightedMultiEdges
public interface MultiEdges
Interface that represents the edges of a graph.
-
Method Summary
Modifier and Type Method Description booleanaddEdge(int orig, int dest, double weight, int type)Adds an edge to the set.booleanaddUser(int idx)Adds a user to the edges.booleancontainsEdge(int orig, int dest)Checks if an edge exists.intgetAdjacentCount(int orig)Gets the number of adjacent edges to a nodejava.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.List<java.lang.Integer>getEdgeTypes(int orig, int dest)Gets the type of an edge.java.util.List<java.lang.Double>getEdgeWeights(int orig, int dest)Gets the weight of an edge.intgetIncidentCount(int dest)Gets the number of incident edges to a nodejava.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.IntStreamgetIsolatedNodes()Obtains the set of nodes which do not have any neighbor.java.util.stream.Stream<java.lang.Integer>getMutualNodes(int node)Gets the neighbors of the user with whom he has both incoming and outgoing links.java.util.stream.Stream<MultiEdgeTypes>getMutualTypes(int node)Gets the types of the neighbourhood edges of a node.java.util.stream.Stream<MultiEdgeWeights>getMutualWeights(int node)Gets the weights of the neighbour edges of a node.intgetNeighbourCount(int node)Gets the number of edges which reach or start in a certain nodejava.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.IntStreamgetNodesWithAdjacentEdges()Obtains the set of nodes which have adjacent edges.java.util.stream.IntStreamgetNodesWithEdges()Obtains the set of nodes which have edges.java.util.stream.IntStreamgetNodesWithIncidentEdges()Obtains the set of nodes which have incident edges.java.util.stream.IntStreamgetNodesWithMutualEdges()Obtains the set of nodes which have, at least, a reciprocal edge.longgetNumEdges()Obtains the number of edgesintgetNumEdges(int orig, int dest)Gets the number of existing edges between two destiniesbooleanhasAdjacentEdges(int idx)Checks if a node has adjacent edges.booleanhasEdges(int idx)Checks if a node has adjacent or incident edges.booleanhasIncidentEdges(int idx)Checks if a node has incident edges.booleanhasMutualEdges(int idx)Checks if a node has mutual 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.
-
Method Details
-
containsEdge
boolean containsEdge(int orig, int dest)Checks if an edge exists.- Parameters:
orig- The origin endpointdest- The destiny endpoint- Returns:
- true if the edge exists, false if not.
-
getNumEdges
int getNumEdges(int orig, int dest)Gets the number of existing edges between two destinies- Parameters:
orig- The origin endpointdest- The destiny endpoint- Returns:
- the number of edges
-
getEdgeWeights
java.util.List<java.lang.Double> getEdgeWeights(int orig, int dest)Gets the weight of an edge.- Parameters:
orig- The origin endpoint.dest- The destiny endpoint.- Returns:
- the value if the edge exists, the default error value if not.
-
getEdgeTypes
java.util.List<java.lang.Integer> getEdgeTypes(int orig, int dest)Gets the type of an edge.- Parameters:
orig- The origin endpoint.dest- The destiny 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 the user with whom he has both incoming and outgoing links.- Parameters:
node- The node.- Returns:
- a stream containing the ids of the mutual neighborhood.
-
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.
-
getMutualTypes
Gets the types of the neighbourhood edges of a node.- Parameters:
node- The node.- Returns:
- a stream containing all the edge types.
-
getIncidentWeights
Gets the weights of the incident edges of a node.- Parameters:
node- The node.- Returns:
- a stream containing all the edge types.
-
getAdjacentWeights
Gets the weights of the adjacent edges of a node.- Parameters:
node- The node.- Returns:
- a stream containing all the edge types.
-
getNeighbourWeights
Gets the weights of the neighbour edges of a node.- Parameters:
node- The node.- Returns:
- a sream containing all the edge types.
-
getMutualWeights
Gets the weights of the neighbour edges of a node.- Parameters:
node- The node.- Returns:
- a sream containing all the edge types.
-
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- Origin nodedest- Destiny nodeweight- Weight of the edgetype- Type of the edge- Returns:
- true if everything went OK, false if not.
-
getIncidentCount
int getIncidentCount(int dest)Gets the number of incident edges to a node- Parameters:
dest- Destiny node- Returns:
- the number of incident edges
-
getAdjacentCount
int getAdjacentCount(int orig)Gets the number of adjacent edges to a node- Parameters:
orig- Origin node- Returns:
- the number of adjacent edges
-
getNeighbourCount
int getNeighbourCount(int node)Gets the number of edges which reach or start in a certain node- Parameters:
node- the node- Returns:
- the number of edges which reach or start in that node
-
getNumEdges
long getNumEdges()Obtains the number of edges- Returns:
- the number of edges
-
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
-
removeEdge
boolean removeEdge(int orig, int dest, int idx)Removes an edge.- Parameters:
orig- source node.dest- incoming node.idx- the number of the edge- 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.
-
removeEdges
boolean removeEdges(int orig, int dest)Removes all the edges between a pair of nodes.- Parameters:
orig- source node.dest- incoming node.- Returns:
- true if everything went OK, false otherwise.
-
updateEdgeWeight
boolean updateEdgeWeight(int orig, int dest, double weight, int idx)Modifies the weight of an edge.- Parameters:
orig- source node.dest- incoming node.idx- the number of the edge.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, int idx)Modifies the weight of an edge.- Parameters:
orig- source node.dest- incoming node.idx- the number of the edge.type- the new type of the edge.- Returns:
- true if everything went OK, false if not, or the edge does not exist.
-