DirectedFlagStream

org.appliedtopology.tda4j.DirectedFlagStream
open class DirectedFlagStream(val n: Int, edges: Iterable[(Int, Int, Double)], val maxDimension: Int, val maxFiltrationValue: Double = ..., vertexValue: Int => Double = ...) extends StratifiedCellStream[DirectedSimplex, Double], DoubleFiltration[DirectedSimplex]

The directed flag complex of a weighted directed graph (the construction of Flagser, Luetgehetmann, Govc, Smith and Levi 2020; Reimann et al. 2017 for the clique complex of a neural network): its cells are the ordered tuples of vertices (v0, ..., vk) such that every edge vi -> vj with i < j is present, and a cell enters at the largest weight of those edges (or of its vertices, which enter at vertexValue, 0 by default).

A directed cycle a -> b -> c -> a is a hole: no tuple contains all three, so the three edges bound nothing. The same three vertices with a -> c in place of c -> a span the filled triangle (a, b, c). An undirected graph (both directions present) gives many more cells than its clique complex, one for every ordering of every clique.

val stream = DirectedFlagStream(4, Seq((0, 1, 1.0), (1, 2, 1.0), (2, 0, 1.0)), maxDimension = 1)
Persistence(stream).bettiNumbers   // Vector(1, 1): a loop

The complex is built for homological degrees 0 .. maxDimension (it holds the cells up to dimension maxDimension + 1), and every cell is held in memory.

Value parameters

edges

(from, to, weight), each ordered pair once; a pair and its reverse may both be present

maxFiltrationValue

cells entering later than this are left out

Attributes

Experimental
true
Source
DirectedFlagStream.scala
Graph
Supertypes
trait CellStream[DirectedSimplex, Double]
trait IterableOnce[DirectedSimplex]
trait Filtration[DirectedSimplex, Double]
trait Filterable[Double]
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

override def homologyDegreeLimit: Option[Int]

Some(k) for a complex cut off to compute homology in degrees 0..k (what VietorisRips(points, maxDimension = k) returns, holding cells up to dimension k + 1): its higher degrees are not the homology of the full complex. None (the default) for a complete complex.

Some(k) for a complex cut off to compute homology in degrees 0..k (what VietorisRips(points, maxDimension = k) returns, holding cells up to dimension k + 1): its higher degrees are not the homology of the full complex. None (the default) for a complete complex.

Attributes

Definition Classes
Source
DirectedFlagStream.scala
override def iterateDimension: PartialFunction[Int, Iterator[DirectedSimplex]]

The cells of dimension d, oldest first. The domain must be contiguous from 0 (0, 1, ..., k, or empty, or all of the naturals): iterator stops at the first dimension where this is undefined.

The cells of dimension d, oldest first. The domain must be contiguous from 0 (0, 1, ..., k, or empty, or all of the naturals): iterator stops at the first dimension where this is undefined.

Attributes

Definition Classes
Source
DirectedFlagStream.scala

Inherited methods

override def iterator: Iterator[DirectedSimplex]

All the cells, dimension by dimension. Stops at the first undefined dimension (takeWhile, never filter, which would search forever past the last one).

All the cells, dimension by dimension. Stops at the first undefined dimension (takeWhile, never filter, which would search forever past the last one).

Attributes

Definition Classes
StratifiedCellStream -> IterableOnce
Inherited from:
StratifiedCellStream
Source
SimplexStream.scala
def knownSize: Int

The number of elements in this collection, if it can be cheaply computed, -1 otherwise. Cheaply usually means: Not requiring a collection traversal.

The number of elements in this collection, if it can be cheaply computed, -1 otherwise. Cheaply usually means: Not requiring a collection traversal.

Attributes

Inherited from:
IterableOnce
Source
IterableOnce.scala
def stepper[S <: Stepper[_]](implicit shape: StepperShape[DirectedSimplex, S]): S

Returns a scala.collection.Stepper for the elements of this collection.

Returns a scala.collection.Stepper for the elements of this collection.

The Stepper enables creating a Java stream to operate on the collection, see scala.jdk.StreamConverters. For collections holding primitive values, the Stepper can be used as an iterator which doesn't box the elements.

The implicit scala.collection.StepperShape parameter defines the resulting Stepper type according to the element type of this collection.

  • For collections of Int, Short, Byte or Char, an scala.collection.IntStepper is returned
  • For collections of Double or Float, a scala.collection.DoubleStepper is returned
  • For collections of Long a scala.collection.LongStepper is returned
  • For any other element type, an scala.collection.AnyStepper is returned

Note that this method is overridden in subclasses and the return type is refined to S with EfficientSplit, for example scala.collection.IndexedSeqOps.stepper. For Steppers marked with scala.collection.Stepper.EfficientSplit, the converters in scala.jdk.StreamConverters allow creating parallel streams, whereas bare Steppers can be converted only to sequential streams.

Attributes

Inherited from:
IterableOnce
Source
IterableOnce.scala

Concrete fields

override val filtrationOrdering: Ordering[DirectedSimplex]

FiltrationOrdering.canonical with the cells' own order as tie-break.

FiltrationOrdering.canonical with the cells' own order as tie-break.

Attributes

Source
DirectedFlagStream.scala
override val filtrationValue: PartialFunction[DirectedSimplex, Double]

Attributes

Source
DirectedFlagStream.scala
val maxDimension: Int

Attributes

Source
DirectedFlagStream.scala
val maxFiltrationValue: Double

Attributes

Source
DirectedFlagStream.scala
val n: Int

Attributes

Source
DirectedFlagStream.scala

Inherited fields

val largest: Double

Attributes

Inherited from:
DoubleFiltration
Source
SimplexStream.scala
val smallest: Double

Attributes

Inherited from:
DoubleFiltration
Source
SimplexStream.scala