Class FastUndirectedWeightedEdges

java.lang.Object
es.uam.eps.ir.relison.graph.edges.fast.FastEdges
es.uam.eps.ir.relison.graph.edges.fast.FastUndirectedWeightedEdges
All Implemented Interfaces:
Edges, UndirectedEdges, WeightedEdges

public class FastUndirectedWeightedEdges
extends FastEdges
implements UndirectedEdges, WeightedEdges
Fast implementation of undirected weighted edges.
  • Constructor Details

  • Method Details

    • getNeighbourNodes

      public java.util.stream.Stream<java.lang.Integer> getNeighbourNodes​(int node)
      Description copied from interface: Edges
      Gets the full neighbourhood of a node.
      Specified by:
      getNeighbourNodes in interface Edges
      Parameters:
      node - The node.
      Returns:
      a stream containing all the ids of the nodes.
    • getNeighbourTypes

      public java.util.stream.Stream<EdgeType> getNeighbourTypes​(int node)
      Description copied from interface: Edges
      Gets the types of the neighbourhood edges of a node.
      Specified by:
      getNeighbourTypes in interface Edges
      Parameters:
      node - The node.
      Returns:
      a stream containing all the edge types.
    • getIncidentWeights

      public java.util.stream.Stream<es.uam.eps.ir.ranksys.fast.preference.IdxPref> getIncidentWeights​(int node)
      Description copied from interface: Edges
      Gets the weights of the incident edges of a node.
      Specified by:
      getIncidentWeights in interface Edges
      Specified by:
      getIncidentWeights in interface UndirectedEdges
      Specified by:
      getIncidentWeights in interface WeightedEdges
      Parameters:
      node - The node.
      Returns:
      a stream containing all the edge types.
    • getAdjacentWeights

      public java.util.stream.Stream<es.uam.eps.ir.ranksys.fast.preference.IdxPref> getAdjacentWeights​(int node)
      Description copied from interface: Edges
      Gets the weights of the adjacent edges of a node.
      Specified by:
      getAdjacentWeights in interface Edges
      Specified by:
      getAdjacentWeights in interface UndirectedEdges
      Specified by:
      getAdjacentWeights in interface WeightedEdges
      Parameters:
      node - The node.
      Returns:
      a stream containing all the edge types.
    • getNeighbourWeights

      public java.util.stream.Stream<es.uam.eps.ir.ranksys.fast.preference.IdxPref> getNeighbourWeights​(int node)
      Description copied from interface: Edges
      Gets the weights of the neighbour edges of a node.
      Specified by:
      getNeighbourWeights in interface Edges
      Specified by:
      getNeighbourWeights in interface WeightedEdges
      Parameters:
      node - The node.
      Returns:
      a sream containing all the edge types.
    • addEdge

      public boolean addEdge​(int orig, int dest, double weight, int type)
      Description copied from interface: Edges
      Adds an edge to the set.
      Specified by:
      addEdge in interface Edges
      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.
    • updateEdgeWeight

      public boolean updateEdgeWeight​(int orig, int dest, double weight)
      Description copied from interface: Edges
      Modifies the weight of an edge.
      Specified by:
      updateEdgeWeight in interface Edges
      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

      public boolean updateEdgeType​(int orig, int dest, int type)
      Description copied from interface: Edges
      Modifies the weight of an edge.
      Specified by:
      updateEdgeType in interface Edges
      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.
    • removeNode

      public boolean removeNode​(int idx)
      Description copied from interface: Edges
      Removes a node from the edge list.
      Specified by:
      removeNode in interface Edges
      Parameters:
      idx - The identifier of the node.
      Returns:
      true if everything went OK, false otherwise.
    • removeEdge

      public boolean removeEdge​(int orig, int dest)
      Description copied from interface: Edges
      Removes an edge.
      Specified by:
      removeEdge in interface Edges
      Parameters:
      orig - Source node.
      dest - Incoming node.
      Returns:
      true if everything went OK, false if not.
    • getNodesWithIncidentEdges

      public java.util.stream.IntStream getNodesWithIncidentEdges()
      Description copied from interface: Edges
      Obtains the set of nodes which have incident edges.
      Specified by:
      getNodesWithIncidentEdges in interface Edges
      Returns:
      a stream containing the ids of nodes with incident edges.
    • getNodesWithAdjacentEdges

      public java.util.stream.IntStream getNodesWithAdjacentEdges()
      Description copied from interface: Edges
      Obtains the set of nodes which have adjacent edges.
      Specified by:
      getNodesWithAdjacentEdges in interface Edges
      Returns:
      a stream containing the ids of nodes with incident edges.
    • getNodesWithEdges

      public java.util.stream.IntStream getNodesWithEdges()
      Description copied from interface: Edges
      Obtains the set of nodes which have edges.
      Specified by:
      getNodesWithEdges in interface Edges
      Returns:
      a stream containing the ids of nodes with incident edges.
    • getNodesWithMutualEdges

      public java.util.stream.IntStream getNodesWithMutualEdges()
      Description copied from interface: Edges
      Obtains the set of nodes which have, at least, a reciprocal edge.
      Specified by:
      getNodesWithMutualEdges in interface Edges
      Returns:
      a stream containing the ids of nodes with reciprocal edges.