Interface FastGraph<U>

Type Parameters:
U - type of the users.
All Superinterfaces:
Graph<U>, ReducedIndex<U>, java.io.Serializable
All Known Subinterfaces:
FastMultiGraph<U>
All Known Implementing Classes:
AbstractFastGraph, AbstractFastMultiGraph, FastDirectedUnweightedGraph, FastDirectedUnweightedMultiGraph, FastDirectedWeightedGraph, FastDirectedWeightedMultiGraph, FastTree, FastUndirectedUnweightedGraph, FastUndirectedUnweightedMultiGraph, FastUndirectedWeightedGraph, FastUndirectedWeightedMultiGraph, FastUnweightedTree, FastWeightedTree

public interface FastGraph<U>
extends Graph<U>, ReducedIndex<U>
Interface for fast implementations of graphs.
  • Method Details

    • getAllNodesIds

      java.util.stream.IntStream getAllNodesIds()
      Obtains the identifiers of all the nodes in the network.
      Returns:
      an stream containing the vertex identifiers.
    • getNodesIdsWithEdges

      java.util.stream.IntStream getNodesIdsWithEdges​(EdgeOrientation direction)
      Obtains the identifiers of the nodes which have edges.
      Parameters:
      direction - the orientation selection.
      Returns:
      a stream containing the corresponding nodes.
    • getIsolatedNodeIds

      java.util.stream.IntStream getIsolatedNodeIds()
      Obtains the set of isolated nodes in the graph.
      Returns:
      a stream containing the isolated nodes.
    • containsEdge

      boolean containsEdge​(int uidx, int vidx)
      Checks whether the network contains an edge or not.
      Parameters:
      uidx - the identifier of the first vertex
      vidx - the identifier of the second vertex
      Returns:
      true if the edge exists, false otherwise.
    • addEdge

      boolean addEdge​(int nodeA, int nodeB, double weight, int type)
      Uncontrolled edge addition method, using ids.
      Parameters:
      nodeA - Identifier of the first node.
      nodeB - Identifier of the second node.
      weight - Weight of the link.
      type - Type of the link.
      Returns:
      true if everything went ok, false otherwise.
    • updateEdgeWeight

      boolean updateEdgeWeight​(int nodeA, int nodeB, double weight)
      Uncontrolled edge update method, using ids.
      Parameters:
      nodeA - Identifier of the first node.
      nodeB - Identifier of the second node.
      weight - Weight of the link.
      Returns:
      true if everything went ok, false otherwise.
    • getEdgeWeight

      double getEdgeWeight​(int uidx, int vidx)
      Obtains the weight of an edge, given the identifiers of the involved nodes.
      Parameters:
      uidx - identifier of the first user.
      vidx - identifier of the second user.
      Returns:
      the weight if it exists, an error value otherwise.
    • getNeighborhood

      java.util.stream.Stream<java.lang.Integer> getNeighborhood​(int uidx, EdgeOrientation orientation)
      Obtains the neighborhood of a node, given its identifier.
      Parameters:
      uidx - the identifier of the node.
      orientation - the orientation of the neighborhood to retrieve.
      Returns:
      an stream containing the neighbors of the node.
    • getNeighborhoodWeights

      java.util.stream.Stream<es.uam.eps.ir.ranksys.fast.preference.IdxPref> getNeighborhoodWeights​(int uidx, EdgeOrientation orientation)
      Obtains the neighborhood of a node and the weight of the edges to each other, given its identifier.
      Parameters:
      uidx - the identifier of the node.
      orientation - the orientation of the neighborhood to retrieve.
      Returns:
      an stream containing the weights of neighbors of the node.
    • getNeighborhoodTypes

      java.util.stream.Stream<EdgeType> getNeighborhoodTypes​(int uidx, EdgeOrientation orientation)
      Obtains the neighborhood of a node and the type of the edges to each other, given its identifier.
      Parameters:
      uidx - the identifier of the node.
      orientation - the orientation of the neighborhood to retrieve.
      Returns:
      an stream containing the edge types of the neighbors of the node.
    • getIndex

      Index<U> getIndex()
      Obtains the index for the vertices.
      Returns:
      the index for the vertices.