Class FastEdges

java.lang.Object
es.uam.eps.ir.relison.graph.edges.fast.FastEdges
All Implemented Interfaces:
Edges
Direct Known Subclasses:
FastDirectedUnweightedEdges, FastDirectedWeightedEdges, FastUndirectedUnweightedEdges, FastUndirectedWeightedEdges

public abstract class FastEdges
extends java.lang.Object
implements Edges
Abstract fast implementation of class Edges.
  • Field Details

    • weights

      protected final AutoRelation<java.lang.Double> weights
      Relation for storing the weights of the edges.
    • types

      protected final AutoRelation<java.lang.Integer> types
      Relation for storing the types of the edges.
    • numEdges

      protected long numEdges
      Current number of edges.
  • Constructor Details

    • FastEdges

      public FastEdges​(AutoRelation<java.lang.Double> weights, AutoRelation<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: Edges
      Checks if an edge exists.
      Specified by:
      containsEdge in interface Edges
      Parameters:
      orig - The source endpoint.
      dest - The incoming endpoint.
      Returns:
      true if the edge exists, false if not.
    • getEdgeWeight

      public double getEdgeWeight​(int orig, int dest)
      Description copied from interface: Edges
      Gets the weight of an edge.
      Specified by:
      getEdgeWeight in interface Edges
      Parameters:
      orig - The source endpoint.
      dest - The incoming endpoint.
      Returns:
      the value if the edge exists, the default error value if not.
    • getEdgeType

      public int getEdgeType​(int orig, int dest)
      Description copied from interface: Edges
      Gets the type of an edge.
      Specified by:
      getEdgeType in interface Edges
      Parameters:
      orig - The source endpoint.
      dest - The incoming endpoint.
      Returns:
      the type if the edge exists, the default error value if not.
    • addUser

      public boolean addUser​(int node)
      Description copied from interface: Edges
      Adds a user to the edges.
      Specified by:
      addUser in interface Edges
      Parameters:
      node - Identifier of the user.
      Returns:
      the user.
    • getNumEdges

      public long getNumEdges()
      Description copied from interface: Edges
      Obtains the number of edges in the graph.
      Specified by:
      getNumEdges in interface Edges
      Returns:
      the number of edges in the graph.
    • getIncidentCount

      public long getIncidentCount​(int node)
      Description copied from interface: Edges
      Gets the number of incident nodes.
      Specified by:
      getIncidentCount in interface Edges
      Parameters:
      node - The node.
      Returns:
      the number of incident nodes.
    • getAdjacentCount

      public long getAdjacentCount​(int node)
      Description copied from interface: Edges
      Gets the number of adjacent nodes.
      Specified by:
      getAdjacentCount in interface Edges
      Parameters:
      node - The node.
      Returns:
      the number of adjacent nodes.
    • getNeighbourCount

      public long getNeighbourCount​(int node)
      Description copied from interface: Edges
      Gets the number of neighbour nodes.
      Specified by:
      getNeighbourCount in interface Edges
      Parameters:
      node - The node.
      Returns:
      the number of neighbour nodes.
    • getMutualCount

      public long getMutualCount​(int node)
      Description copied from interface: Edges
      Gets the number of nodes which are, at the same time, adjacent and incident.
      Specified by:
      getMutualCount in interface Edges
      Parameters:
      node - The node.
      Returns:
      the number of mutual neighbors.
    • getIsolatedNodes

      public java.util.stream.IntStream getIsolatedNodes()
      Description copied from interface: Edges
      Obtains the set of nodes which do not have any neighbor.
      Specified by:
      getIsolatedNodes in interface Edges
      Returns:
      a stream containing the set of nodes which do not have neighbors.
    • hasAdjacentEdges

      public boolean hasAdjacentEdges​(int node)
      Description copied from interface: Edges
      Checks if a node has adjacent edges.
      Specified by:
      hasAdjacentEdges in interface Edges
      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: Edges
      Checks if a node has incident edges.
      Specified by:
      hasIncidentEdges in interface Edges
      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: Edges
      Checks if a node has adjacent or incident edges.
      Specified by:
      hasEdges in interface Edges
      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: Edges
      Checks if a node has mutual edges.
      Specified by:
      hasMutualEdges in interface Edges
      Parameters:
      node - The identifier of the node.
      Returns:
      true if it has mutual edges, false otherwise.