Class GraphSimplePreferenceData<U>

java.lang.Object
es.uam.eps.ir.ranksys.core.preference.SimplePreferenceData<U,​U>
es.uam.eps.ir.relison.links.data.GraphSimplePreferenceData<U>
Type Parameters:
U - Type of the users.
All Implemented Interfaces:
es.uam.eps.ir.ranksys.core.index.ItemIndex<U>, es.uam.eps.ir.ranksys.core.index.UserIndex<U>, es.uam.eps.ir.ranksys.core.preference.PreferenceData<U,​U>, java.io.Serializable

public class GraphSimplePreferenceData<U>
extends es.uam.eps.ir.ranksys.core.preference.SimplePreferenceData<U,​U>
Simple map-based preference data for social network evaluation.
See Also:
Serialized Form
  • Constructor Summary

    Constructors 
    Modifier Constructor Description
    protected GraphSimplePreferenceData​(java.util.Map<U,​java.util.List<es.uam.eps.ir.ranksys.core.preference.IdPref<U>>> userMap, java.util.Map<U,​java.util.List<es.uam.eps.ir.ranksys.core.preference.IdPref<U>>> itemMap, int numPreferences)
    Constructor.
  • Method Summary

    Modifier and Type Method Description
    static <U> GraphSimplePreferenceData<U> load​(Graph<U> graph)
    Loads the preference data from a graph.
    static <U> GraphSimplePreferenceData<U> load​(java.util.stream.Stream<org.jooq.lambda.tuple.Tuple3<U,​U,​java.lang.Double>> tuples, boolean directed, boolean weighted)
    Loads a SimplePreferenceData from a stream of user-item-value triples.
    static <U,​ O> GraphSimplePreferenceData<U> load​(java.util.stream.Stream<org.jooq.lambda.tuple.Tuple4<U,​U,​java.lang.Double,​O>> tuples, org.jooq.lambda.function.Function4<U,​U,​java.lang.Double,​O,​? extends es.uam.eps.ir.ranksys.core.preference.IdPref<U>> uPrefFun, boolean directed, boolean weighted)
    Loads an instance of the class from a stream of tuples possibly containing extra information.

    Methods inherited from class es.uam.eps.ir.ranksys.core.preference.SimplePreferenceData

    containsItem, containsUser, getAllItems, getAllUsers, getItemPreferences, getItemsWithPreferences, getUserPreferences, getUsersWithPreferences, load, load, numItems, numItems, numItemsWithPreferences, numPreferences, numUsers, numUsers, numUsersWithPreferences

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GraphSimplePreferenceData

      protected GraphSimplePreferenceData​(java.util.Map<U,​java.util.List<es.uam.eps.ir.ranksys.core.preference.IdPref<U>>> userMap, java.util.Map<U,​java.util.List<es.uam.eps.ir.ranksys.core.preference.IdPref<U>>> itemMap, int numPreferences)
      Constructor.
      Parameters:
      userMap - map that links users to their followees.
      itemMap - map that links users to their followers.
      numPreferences - number of preferences (the number of edges in the graph if directed, twice that number if undirected).
  • Method Details

    • load

      public static <U> GraphSimplePreferenceData<U> load​(Graph<U> graph)
      Loads the preference data from a graph.
      Type Parameters:
      U - Type of the users.
      Parameters:
      graph - the graph containing the preference data.
      Returns:
      a preference data object.
    • load

      public static <U> GraphSimplePreferenceData<U> load​(java.util.stream.Stream<org.jooq.lambda.tuple.Tuple3<U,​U,​java.lang.Double>> tuples, boolean directed, boolean weighted)
      Loads a SimplePreferenceData from a stream of user-item-value triples.
      Type Parameters:
      U - user type
      Parameters:
      tuples - user-item-value triples
      directed - indicates if the graph is directed or not.
      weighted - indicates if the graph is weighted or not.
      Returns:
      instance of SimplePreferenceData containing the information in the input
    • load

      public static <U,​ O> GraphSimplePreferenceData<U> load​(java.util.stream.Stream<org.jooq.lambda.tuple.Tuple4<U,​U,​java.lang.Double,​O>> tuples, org.jooq.lambda.function.Function4<U,​U,​java.lang.Double,​O,​? extends es.uam.eps.ir.ranksys.core.preference.IdPref<U>> uPrefFun, boolean directed, boolean weighted)
      Loads an instance of the class from a stream of tuples possibly containing extra information.
      Type Parameters:
      U - type of user
      O - type of additional information
      Parameters:
      tuples - stream of user-item-value triples
      uPrefFun - creator of preference objects
      directed - indicates if the graph is directed or not.
      weighted - indicates if the graph is weighted or not.
      Returns:
      a preference data object