Class FastMultiEdges
java.lang.Object
es.uam.eps.ir.relison.graph.multigraph.edges.fast.FastMultiEdges
- All Implemented Interfaces:
MultiEdges
- Direct Known Subclasses:
FastDirectedUnweightedMultiEdges,FastDirectedWeightedMultiEdges,FastUndirectedUnweightedMultiEdges,FastUndirectedWeightedMultiEdges
public abstract class FastMultiEdges extends java.lang.Object implements MultiEdges
Abstract fast implementation of class MultiEdges.
-
Field Summary
Fields Modifier and Type Field Description protected longnumEdgesNumber of edges.protected AutoRelation<java.util.List<java.lang.Integer>>typesRelation for storing the types of the edges.protected AutoRelation<java.util.List<java.lang.Double>>weightsRelation for storing the weights of the edges. -
Constructor Summary
Constructors Constructor Description FastMultiEdges(AutoRelation<java.util.List<java.lang.Double>> weights, AutoRelation<java.util.List<java.lang.Integer>> types)Constructor. -
Method Summary
Modifier and Type Method Description booleanaddUser(int node)Adds a user to the edges.booleancontainsEdge(int orig, int dest)Checks if an edge exists.intgetAdjacentCount(int dest)Gets the number of adjacent edges to a nodejava.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.IntStreamgetIsolatedNodes()Obtains the set of nodes which do not have any neighbor.longgetNumEdges()Obtains the number of edgesintgetNumEdges(int orig, int dest)Gets the number of existing edges between two destiniesbooleanhasAdjacentEdges(int node)Checks if a node has adjacent edges.booleanhasEdges(int node)Checks if a node has adjacent or incident edges.booleanhasIncidentEdges(int node)Checks if a node has incident edges.booleanhasMutualEdges(int node)Checks if a node has mutual edges.Methods 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
addEdge, getAdjacentNodes, getAdjacentTypes, getAdjacentWeights, getIncidentNodes, getIncidentTypes, getIncidentWeights, getMutualNodes, getMutualTypes, getMutualWeights, getNeighbourCount, getNeighbourNodes, getNeighbourTypes, getNeighbourWeights, getNodesWithAdjacentEdges, getNodesWithEdges, getNodesWithIncidentEdges, getNodesWithMutualEdges, removeEdge, removeEdges, removeNode, updateEdgeType, updateEdgeWeight
-
Field Details
-
Constructor Details
-
FastMultiEdges
public FastMultiEdges(AutoRelation<java.util.List<java.lang.Double>> weights, AutoRelation<java.util.List<java.lang.Integer>> types)Constructor.- Parameters:
weights- The weights of the edges.types- The types of the edges
-
-
Method Details
-
containsEdge
public boolean containsEdge(int orig, int dest)Description copied from interface:MultiEdgesChecks if an edge exists.- Specified by:
containsEdgein interfaceMultiEdges- Parameters:
orig- The origin endpointdest- The destiny endpoint- Returns:
- true if the edge exists, false if not.
-
getEdgeWeights
public java.util.List<java.lang.Double> getEdgeWeights(int orig, int dest)Description copied from interface:MultiEdgesGets the weight of an edge.- Specified by:
getEdgeWeightsin interfaceMultiEdges- Parameters:
orig- The origin endpoint.dest- The destiny endpoint.- Returns:
- the value if the edge exists, the default error value if not.
-
getEdgeTypes
public java.util.List<java.lang.Integer> getEdgeTypes(int orig, int dest)Description copied from interface:MultiEdgesGets the type of an edge.- Specified by:
getEdgeTypesin interfaceMultiEdges- Parameters:
orig- The origin endpoint.dest- The destiny endpoint.- Returns:
- the type if the edge exists, the default error value if not.
-
addUser
public boolean addUser(int node)Description copied from interface:MultiEdgesAdds a user to the edges.- Specified by:
addUserin interfaceMultiEdges- Parameters:
node- Identifier of the user- Returns:
- the user.
-
getNumEdges
public int getNumEdges(int orig, int dest)Description copied from interface:MultiEdgesGets the number of existing edges between two destinies- Specified by:
getNumEdgesin interfaceMultiEdges- Parameters:
orig- The origin endpointdest- The destiny endpoint- Returns:
- the number of edges
-
getNumEdges
public long getNumEdges()Description copied from interface:MultiEdgesObtains the number of edges- Specified by:
getNumEdgesin interfaceMultiEdges- Returns:
- the number of edges
-
getIncidentCount
public int getIncidentCount(int dest)Description copied from interface:MultiEdgesGets the number of incident edges to a node- Specified by:
getIncidentCountin interfaceMultiEdges- Parameters:
dest- Destiny node- Returns:
- the number of incident edges
-
getAdjacentCount
public int getAdjacentCount(int dest)Description copied from interface:MultiEdgesGets the number of adjacent edges to a node- Specified by:
getAdjacentCountin interfaceMultiEdges- Parameters:
dest- Origin node- Returns:
- the number of adjacent edges
-
getIsolatedNodes
public java.util.stream.IntStream getIsolatedNodes()Description copied from interface:MultiEdgesObtains the set of nodes which do not have any neighbor.- Specified by:
getIsolatedNodesin interfaceMultiEdges- Returns:
- a stream containing the set of nodes which do not have neighbors.
-
hasAdjacentEdges
public boolean hasAdjacentEdges(int node)Description copied from interface:MultiEdgesChecks if a node has adjacent edges.- Specified by:
hasAdjacentEdgesin interfaceMultiEdges- Parameters:
node- the identifier of the node- Returns:
- true if it has adjacent edges, false otherwise
-
hasIncidentEdges
public boolean hasIncidentEdges(int node)Description copied from interface:MultiEdgesChecks if a node has incident edges.- Specified by:
hasIncidentEdgesin interfaceMultiEdges- Parameters:
node- the identifier of the node- Returns:
- true if it has incident edges, false otherwise
-
hasEdges
public boolean hasEdges(int node)Description copied from interface:MultiEdgesChecks if a node has adjacent or incident edges.- Specified by:
hasEdgesin interfaceMultiEdges- Parameters:
node- the identifier of the node- Returns:
- true if it has adjacent or incident edges, false otherwise
-
hasMutualEdges
public boolean hasMutualEdges(int node)Description copied from interface:MultiEdgesChecks if a node has mutual edges.- Specified by:
hasMutualEdgesin interfaceMultiEdges- Parameters:
node- the identifier of the node- Returns:
- true if it has mutual edges, false otherwise
-