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 SummaryFields 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 SummaryConstructors Constructor Description FastMultiEdges(AutoRelation<java.util.List<java.lang.Double>> weights, AutoRelation<java.util.List<java.lang.Integer>> types)Constructor.
- 
Method SummaryModifier 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.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface es.uam.eps.ir.relison.graph.multigraph.edges.MultiEdgesaddEdge, 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- 
FastMultiEdgespublic 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- 
containsEdgepublic boolean containsEdge(int orig, int dest)Description copied from interface:MultiEdgesChecks if an edge exists.- Specified by:
- containsEdgein interface- MultiEdges
- Parameters:
- orig- The origin endpoint
- dest- The destiny endpoint
- Returns:
- true if the edge exists, false if not.
 
- 
getEdgeWeightspublic java.util.List<java.lang.Double> getEdgeWeights(int orig, int dest)Description copied from interface:MultiEdgesGets the weight of an edge.- Specified by:
- getEdgeWeightsin interface- MultiEdges
- Parameters:
- orig- The origin endpoint.
- dest- The destiny endpoint.
- Returns:
- the value if the edge exists, the default error value if not.
 
- 
getEdgeTypespublic java.util.List<java.lang.Integer> getEdgeTypes(int orig, int dest)Description copied from interface:MultiEdgesGets the type of an edge.- Specified by:
- getEdgeTypesin interface- MultiEdges
- Parameters:
- orig- The origin endpoint.
- dest- The destiny endpoint.
- Returns:
- the type if the edge exists, the default error value if not.
 
- 
addUserpublic boolean addUser(int node)Description copied from interface:MultiEdgesAdds a user to the edges.- Specified by:
- addUserin interface- MultiEdges
- Parameters:
- node- Identifier of the user
- Returns:
- the user.
 
- 
getNumEdgespublic int getNumEdges(int orig, int dest)Description copied from interface:MultiEdgesGets the number of existing edges between two destinies- Specified by:
- getNumEdgesin interface- MultiEdges
- Parameters:
- orig- The origin endpoint
- dest- The destiny endpoint
- Returns:
- the number of edges
 
- 
getNumEdgespublic long getNumEdges()Description copied from interface:MultiEdgesObtains the number of edges- Specified by:
- getNumEdgesin interface- MultiEdges
- Returns:
- the number of edges
 
- 
getIncidentCountpublic int getIncidentCount(int dest)Description copied from interface:MultiEdgesGets the number of incident edges to a node- Specified by:
- getIncidentCountin interface- MultiEdges
- Parameters:
- dest- Destiny node
- Returns:
- the number of incident edges
 
- 
getAdjacentCountpublic int getAdjacentCount(int dest)Description copied from interface:MultiEdgesGets the number of adjacent edges to a node- Specified by:
- getAdjacentCountin interface- MultiEdges
- Parameters:
- dest- Origin node
- Returns:
- the number of adjacent edges
 
- 
getIsolatedNodespublic java.util.stream.IntStream getIsolatedNodes()Description copied from interface:MultiEdgesObtains the set of nodes which do not have any neighbor.- Specified by:
- getIsolatedNodesin interface- MultiEdges
- Returns:
- a stream containing the set of nodes which do not have neighbors.
 
- 
hasAdjacentEdgespublic boolean hasAdjacentEdges(int node)Description copied from interface:MultiEdgesChecks if a node has adjacent edges.- Specified by:
- hasAdjacentEdgesin interface- MultiEdges
- Parameters:
- node- the identifier of the node
- Returns:
- true if it has adjacent edges, false otherwise
 
- 
hasIncidentEdgespublic boolean hasIncidentEdges(int node)Description copied from interface:MultiEdgesChecks if a node has incident edges.- Specified by:
- hasIncidentEdgesin interface- MultiEdges
- Parameters:
- node- the identifier of the node
- Returns:
- true if it has incident edges, false otherwise
 
- 
hasEdgespublic boolean hasEdges(int node)Description copied from interface:MultiEdgesChecks if a node has adjacent or incident edges.- Specified by:
- hasEdgesin interface- MultiEdges
- Parameters:
- node- the identifier of the node
- Returns:
- true if it has adjacent or incident edges, false otherwise
 
- 
hasMutualEdgespublic boolean hasMutualEdges(int node)Description copied from interface:MultiEdgesChecks if a node has mutual edges.- Specified by:
- hasMutualEdgesin interface- MultiEdges
- Parameters:
- node- the identifier of the node
- Returns:
- true if it has mutual edges, false otherwise
 
 
-