com.twitter.cassovary.graph

GraphUtils

class GraphUtils extends AnyRef

This class contains some common graph utilities and convenience functions.

Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. GraphUtils
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new GraphUtils(graph: Graph)

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. def allPathsWalk(dir: GraphDir, startNodeId: Int, numTopPathsPerNode: Int, walkLimits: Limits): (VisitsCounter, PrevNbrCounter)

    This is a breadth-first all paths walk with possible multiple visits to a node along the direction specified by dir.

    This is a breadth-first all paths walk with possible multiple visits to a node along the direction specified by dir.

    All paths walk is a queue based walk, where each node adds all her neighbors to the queue and each node can be visited multiple times.

    numTopPathsPerNode

    number of paths per node to keep track of

    walkLimits

    walk limits

    returns

    a pair of elements

    1. Counter tracking a visited node's id V and the number of visits to that node. 2. Counter tracking a visited node's id V and a set of neighbors. The neighbors are sorted in decreasing order by occurrence.
  7. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  8. def bfsWalk(startNodeId: Int, dir: GraphDir, walkLimits: Limits): Seq[(Int, Int)]

    This is a breadth-first walk along the direction specified by dir.

    This is a breadth-first walk along the direction specified by dir.

    startNodeId

    node to start the random walk from. These must exist in the graph.

    walkLimits

    walk limits

    returns

    a sequence of visited nodes and depths of the visit (or empty sequence if startNodeId was not found in the graph)

  9. def calculateAllPathsWalk(startNodeId: Int, dir: GraphDir, numTopPathsPerNode: Int, walkLimits: Limits): (Map[Int, Int], Map[Int, Int2IntMap])

    Does a breadth-first-walk starting from startNodeId using the walk parameters specified in walkParams.

    Does a breadth-first-walk starting from startNodeId using the walk parameters specified in walkParams. Returns a 2-tuple: 1. List of (node's id, the number of visits made to the node) sorted in decreasing order of the number of visits, and 2. A mapping for a visited node with id V to the top paths leading to V in the form of (P as a DirectedPath, frequency of walking P).

  10. def calculatePersonalizedReputation(startNodeId: Int, walkParams: RandomWalkParams): (Map[Int, Int], Option[Map[Int, Object2IntMap[DirectedPath]]])

  11. def calculatePersonalizedReputation(startNodeIds: Seq[Int], walkParams: RandomWalkParams): (Map[Int, Int], Option[Map[Int, Object2IntMap[DirectedPath]]])

    Calculates the reputation of graph nodes personalized to a given node based on a random walk.

    Calculates the reputation of graph nodes personalized to a given node based on a random walk.

    startNodeIds

    the ids of the node to get personalized reputations for

    walkParams

    the RandomWalkParams random walk parameters

    returns

    a 2-tuple:

    1. List of (node's id, the number of visits made to the node) sorted in decreasing order of the number of visits, and 2. A mapping, for a visited node with id V to the top paths leading to V in the form of (P as a DirectedPath, frequency of walking P).
  12. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  13. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  14. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  15. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  16. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  17. def getNumMutualEdgesBothDirs(node: Node): Long

    Assuming that the node stores both directions of edges, calculate the number of mutual edges incident on this node

    Assuming that the node stores both directions of edges, calculate the number of mutual edges incident on this node

    returns

    number of neighbors of node that have an edge to and from this node

  18. val graph: Graph

  19. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  20. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  21. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  22. def neighborCount(id: Int, dir: GraphDir): Int

    id

    the id of the node to count neighbors of

    dir

    the direction of interest

    returns

    number of neighbors (i.e., number of nodes 1 hop away) in dir. Warning: Lossy: Returns 0 if id is not found.

  23. final def notify(): Unit

    Definition Classes
    AnyRef
  24. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  25. def randomWalk(dir: GraphDir, startNodeIds: Seq[Int], walkParams: RandomWalkParams)(): (VisitsCounter, Option[PathsCounter])

    Do a random walk starting from the set of nodes with ids startNodeIds.

    Do a random walk starting from the set of nodes with ids startNodeIds. The walk maintains a count of the number of times that nodes have been visited during the walk.

    startNodeIds

    nodes to start the random walk from

    walkParams

    the RandomWalkParams random walk parameters

    returns

    a tuple of two elements. The first is a counter tracking a visited node's id to the number of visits to that node. The second is a counter tracking a visited node's id to the paths visited while hitting that node. The paths are sorted in decreasing order by occurrence Each path is kept as a DirectedPath.

  26. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  27. def toString(): String

    Definition Classes
    AnyRef → Any
  28. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped