Class EdgeQueue

java.lang.Object
com.github.oeuvres.alix.util.EdgeQueue
All Implemented Interfaces:
Iterable<Edge>

public class EdgeQueue extends Object implements Iterable<Edge>
An object to record edges events (a pair of int), recorder as list of long. Fast for writing, no lookup, maybe expensive in memory if a lots of events. Iterator by count.
  • Constructor Details

    • EdgeQueue

      public EdgeQueue(boolean directed)
      Directed (1,2) ≠ (2,1). Not directed (1,2) = (2,1).
      Parameters:
      directed - true if direction should be kept, false otherwise.
  • Method Details

    • clust

      public void clust(int node)
      Agregate a node to a cluster.
      Parameters:
      node - a node id.
    • declust

      public void declust()
      Start a cluster (a set of nodes totally connected).
    • iterator

      public Iterator<Edge> iterator()
      Specified by:
      iterator in interface Iterable<Edge>
    • push

      public void push(int sourceId, int targetId)
      Add an edge. If not directed, the edge will be recorded with smallest node id first.
      Parameters:
      sourceId - a node id.
      targetId - a node id.
    • size

      public int size()
      Count of push events.
      Returns:
      this.size.